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

feat(windows): add state machine to control installation including apply now update 💽 #12079

Merged
merged 55 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e83b002
feat(windows): WIP buc sm doesn't build just backup
rc-swag Dec 12, 2023
947b829
feat(windows): WIP
rc-swag Dec 13, 2023
dee525f
chore(windows): Merge branch 'feat/windows/remove-ui-com-onlineupdate…
rc-swag Dec 13, 2023
bca5329
feat(windows): WIP merge sm
rc-swag Dec 14, 2023
6cb8398
feat(windows): WIP added keyman has run atom
rc-swag Dec 19, 2023
dd5767a
feat(windows): integrate sm states and handlekmshell
rc-swag Dec 22, 2023
486586d
feat(windows): apply now install for state machine
rc-swag Dec 22, 2023
2eab485
feat(windows): Add a installNow event to SM
rc-swag Jan 10, 2024
2a6a743
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Jan 10, 2024
3dc3a25
feat(windows): remove stub comments
rc-swag Jan 10, 2024
f7744f9
feat(windows): mark outstanding issues with feature
rc-swag Jan 11, 2024
8454285
chore(windows): Merge branch 'feat/windows/add-state-machine-o-update…
rc-swag Jan 11, 2024
e29e212
feat(windows): WIP - leave commit so work not lost
rc-swag Jan 23, 2024
db18917
feat(windows): project file listing updated
rc-swag Jan 23, 2024
29b54ad
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Mar 4, 2024
47d3d26
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Jun 29, 2024
14310a1
feat(windows): rename files to new delphi pattern
rc-swag Jul 2, 2024
a9fd916
feat(windows): small refactor of sm wip
rc-swag Jul 17, 2024
bf2d8f9
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Jul 23, 2024
d6258e5
feat(windows): add checkconfig for updated download
rc-swag Jul 23, 2024
9f72feb
feat(windows): merge conflicts wip
rc-swag Jul 24, 2024
b0cdcab
feat(windows): correct error checking for has keyman run
rc-swag Aug 13, 2024
c86ecfd
feat(windows): use CU registry key for statemachine state
rc-swag Aug 14, 2024
a7736a0
feat(windows): remove duplicate localisation string id
rc-swag Aug 14, 2024
98cd1f5
feat(windows): add handledownload back in
rc-swag Aug 16, 2024
6a305c1
feat(windows): remove uneeded registry keys
rc-swag Aug 16, 2024
50a56c9
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Aug 27, 2024
e2ec08c
feat(windows): remove klogging enable
rc-swag Aug 27, 2024
4c1aa0f
feat(windows): add basic modal install form
rc-swag Aug 29, 2024
8df507d
feat(windows): add menuframe_update image 4 config
rc-swag Aug 29, 2024
7860ddc
feat(windows): add update to strings.xml
rc-swag Sep 2, 2024
1667cfe
feat(windows): clean up ready for review
rc-swag Sep 3, 2024
85a998b
feat(windows): rename executehistory module for clarity
rc-swag Sep 3, 2024
cb341d9
chore(windows): Merge branch 'feat/windows/add-apply-now-update' into…
rc-swag Sep 3, 2024
eff8a88
feat(windows): resize and add title for install now
rc-swag Sep 3, 2024
bfe1b45
feat(windows): automatic updates option to config reg
rc-swag Sep 9, 2024
4c48408
Merge pull request #12375 from keymanapp/feat/windows/automatic-updat…
rc-swag Sep 9, 2024
1acf0d0
Merge pull request #12353 from keymanapp/feat/windows/install-now-pop-up
rc-swag Sep 9, 2024
033cb22
feat(windows): changes update form now
rc-swag Sep 10, 2024
3f1236a
feat(windows): comments copyright formating
rc-swag Sep 10, 2024
5c187db
feat(windows): address review comments
rc-swag Sep 12, 2024
06de2b0
feat(windows): change automatic update description
rc-swag Sep 12, 2024
4ad5f0f
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Oct 1, 2024
b4f52be
feat(windows): rename UI forms to convention
rc-swag Oct 2, 2024
c988271
feat(windows): formatting review suggestions
rc-swag Oct 15, 2024
ac38649
feat(windows): More formatting fixes.
rc-swag Oct 15, 2024
141bfda
feat(windows): remove redundant time since last update
rc-swag Oct 22, 2024
3cf1fe5
feat(windows): use FStateInstance array instead
rc-swag Oct 23, 2024
f2d0e26
feat(windows): remove TUpdateStateMachineParams
rc-swag Oct 30, 2024
544b955
feat(windows): add error checking - private class
rc-swag Nov 1, 2024
7be490a
feat(windows): review comment suggestions
rc-swag Nov 5, 2024
e239ec7
feat(windows): Review comments
rc-swag Nov 5, 2024
79a23a7
chore(windows): Merge branch 'epic/windows-updates' into feat/windows…
rc-swag Nov 6, 2024
883092e
feat(windows): fix installHelper
rc-swag Nov 6, 2024
ab3227f
feat(windows): review comments
rc-swag Nov 7, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
Keyman is copyright (C) SIL Global. MIT License.

This module provides functionality to track the execution state of the Keyman
engine. It uses a global atom to record whether Keyman has started during the
current session and checks if it has previously run.
}
unit Keyman.System.ExecutionHistory;


interface

const
AtomName = 'KeymanSessionFlag';

function RecordKeymanStarted : Boolean;
function HasKeymanRun : Boolean;

implementation

uses
System.SysUtils,
Winapi.Windows,
KLog;

function RecordKeymanStarted : Boolean;
var
atom: WORD;
begin
atom := GlobalAddAtom(AtomName);
if atom = 0 then
begin
// TODO-WINDOWS-UPDATES: #10210 log to sentry
Result := False;
end
else
Result := True;
end;

function HasKeymanRun : Boolean;
begin
Result := GlobalFindAtom(AtomName) <> 0;
if not Result then
begin
if GetLastError <> ERROR_FILE_NOT_FOUND then
begin
// TODO-WINDOWS-UPDATES: log to Sentry
end;
end;
end;

end.
8 changes: 6 additions & 2 deletions common/windows/delphi/general/RegistryKeys.pas
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ interface

SRegValue_CharMapSourceData = 'charmap source data'; // LM

SRegValue_AvailableLanguages = 'available languages'; //CU
SRegValue_CurrentLanguage = 'current language'; //CU
SRegValue_AvailableLanguages = 'available languages'; // CU
SRegValue_CurrentLanguage = 'current language'; // CU

SRegValue_Update_State = 'update state'; // CU

{ Privacy }

Expand Down Expand Up @@ -312,8 +314,10 @@ interface
SRegValue_ActiveProject_Filename = 'project filename';
SRegValue_ActiveProject_SourcePath = 'source path';

SRegValue_AutomaticUpdates = 'automatic updates'; //CU
SRegValue_CheckForUpdates = 'check for updates'; // CU
SRegValue_LastUpdateCheckTime = 'last update check time'; // CU
SRegValue_ApplyNow = 'apply now'; // CU Start the install now even though it will require an restart

SRegValue_UpdateCheck_UseProxy = 'update check use proxy'; // CU
SRegValue_UpdateCheck_ProxyHost = 'update check proxy host'; // CU
Expand Down
5 changes: 5 additions & 0 deletions oem/firstvoices/windows/src/xml/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@
<!-- Introduced: 7.0.230.0 -->
<string name="koShowWelcome" comment="Startup options - show/hide welcome screen">Show welcome screen</string>

<!-- Context: Configuration Dialog - Options tab -->
<!-- String Type: FormatString -->
<!-- Introduced: 18.0.96.0 -->
<string name="koAutomaticUpdate" comment="Automatically download updates in the background, for installation later">Automatically download updates in the background, for installation later</string>

<!-- Context: Configuration Dialog - Options tab -->
<!-- String Type: FormatString -->
<!-- Introduced: 7.0.230.0 -->
Expand Down
7 changes: 6 additions & 1 deletion windows/src/desktop/kmshell/kmshell.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ uses
Keyman.Configuration.System.Main in 'main\Keyman.Configuration.System.Main.pas',
UpdateXMLRenderer in 'render\UpdateXMLRenderer.pas',
Keyman.System.UpdateCheckStorage in 'main\Keyman.System.UpdateCheckStorage.pas',
Keyman.System.RemoteUpdateCheck in 'main\Keyman.System.RemoteUpdateCheck.pas';
Keyman.System.RemoteUpdateCheck in 'main\Keyman.System.RemoteUpdateCheck.pas',
Keyman.System.UpdateStateMachine in 'main\Keyman.System.UpdateStateMachine.pas',
Keyman.System.DownloadUpdate in 'main\Keyman.System.DownloadUpdate.pas',
Keyman.System.ExecutionHistory in '..\..\..\..\common\windows\delphi\general\Keyman.System.ExecutionHistory.pas',
Keyman.Configuration.UI.UfrmStartInstallNow in 'main\Keyman.Configuration.UI.UfrmStartInstallNow.pas' {frmInstallNow},
Keyman.Configuration.UI.UfrmStartInstall in 'main\Keyman.Configuration.UI.UfrmStartInstall.pas' {frmStartInstall};

{$R VERSION.RES}
{$R manifest.res}
Expand Down
20 changes: 16 additions & 4 deletions windows/src/desktop/kmshell/kmshell.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@
<DCCReference Include="render\UpdateXMLRenderer.pas"/>
<DCCReference Include="main\Keyman.System.UpdateCheckStorage.pas"/>
<DCCReference Include="main\Keyman.System.RemoteUpdateCheck.pas"/>
<DCCReference Include="main\Keyman.System.UpdateStateMachine.pas"/>
<DCCReference Include="main\Keyman.System.DownloadUpdate.pas"/>
<DCCReference Include="..\..\..\..\common\windows\delphi\general\Keyman.System.ExecutionHistory.pas"/>
<DCCReference Include="main\Keyman.Configuration.UI.UfrmStartInstallNow.pas">
<Form>frmInstallNow</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="main\Keyman.Configuration.UI.UfrmStartInstall.pas">
<Form>frmStartInstall</Form>
<FormType>dfm</FormType>
</DCCReference>
<None Include="Profiling\AQtimeModule1.aqt"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
Expand Down Expand Up @@ -418,21 +429,21 @@
<Platform value="Win64">False</Platform>
</Platforms>
<Deployment Version="3">
<DeployFile LocalName="bin\Win32\Debug\kmshell.exe" Configuration="Debug" Class="ProjectOutput">
<DeployFile LocalName="bin\Win32\Debug\kmshell.rsm" Configuration="Debug" Class="DebugSymbols">
<Platform Name="Win32">
<RemoteName>kmshell.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="kmshell.exe" Configuration="Debug" Class="ProjectOutput">
<DeployFile LocalName="bin\Win32\Debug\kmshell.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>kmshell.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\Win32\Debug\kmshell.rsm" Configuration="Debug" Class="DebugSymbols">
<DeployFile LocalName="kmshell.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>kmshell.rsm</RemoteName>
<RemoteName>kmshell.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
Expand Down Expand Up @@ -1231,6 +1242,7 @@
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
</Deployment>
<ModelSupport>False</ModelSupport>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
Expand Down
Binary file added windows/src/desktop/kmshell/kmshell.res
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
``` mermaid
stateDiagram
[*] --> Idle
Idle --> UpdateAvailable
UpdateAvailable --> Downloading
Downloading --> Installing
Downloading --> WaitingRestart
WaitingRestart --> Installing
Installing --> PostInstall
PostInstall --> Idle
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
object frmStartInstall: TfrmStartInstall
Left = 0
Top = 0
Caption = 'Keyman Update'
ClientHeight = 225
ClientWidth = 425
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object lblInstallUpdate: TLabel
Left = 128
Top = 96
Width = 175
Height = 19
Caption = 'Keyman update available'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object cmdInstall: TButton
Left = 228
Top = 184
Width = 75
Height = 25
Caption = 'Install'
ModalResult = 1
TabOrder = 0
end
object cmdLater: TButton
Left = 336
Top = 184
Width = 75
Height = 25
Caption = 'Close'
ModalResult = 8
TabOrder = 1
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
Keyman is copyright (C) SIL Global. MIT License.

// TODO-WINDOWS-UPDATES: Localise all the labels and captions.
}
unit Keyman.Configuration.UI.UfrmStartInstall;
interface

uses
System.Classes,
System.SysUtils,
System.Variants,
Vcl.Controls,
Vcl.Dialogs,
Vcl.ExtCtrls,
Vcl.Forms,
Vcl.Graphics,
Vcl.StdCtrls,
Winapi.Messages,
Winapi.Windows,
UfrmKeymanBase,
UserMessages;

type
TfrmStartInstall = class(TfrmKeymanBase)
cmdInstall: TButton;
cmdLater: TButton;
lblInstallUpdate: TLabel;
private
public
end;


implementation

{$R *.dfm}


end.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
object frmStartInstallNow: TfrmStartInstallNow
Left = 0
Top = 0
Caption = 'Keyman Update'
ClientHeight = 225
ClientWidth = 425
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object lblUpdateMessage: TLabel
Left = 56
Top = 88
Width = 274
Height = 19
Caption = 'Keyman and Windows will be restarted'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
WordWrap = True
end
object lblUpdateNow: TLabel
Left = 56
Top = 40
Width = 115
Height = 25
Caption = 'Update Now'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -21
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object cmdInstall: TButton
Left = 228
Top = 184
Width = 75
Height = 25
Caption = 'Update'
ModalResult = 1
TabOrder = 0
end
object cmdLater: TButton
Left = 336
Top = 184
Width = 75
Height = 25
Caption = 'Close'
ModalResult = 8
TabOrder = 1
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
Keyman is copyright (C) SIL Global. MIT License.

// TODO-WINDOWS-UPDATES: Localise all the labels and captions.
}
unit Keyman.Configuration.UI.UfrmStartInstallNow;
interface

uses
System.Classes,
System.SysUtils,
System.Variants,
Vcl.Controls,
Vcl.Dialogs,
Vcl.ExtCtrls,
Vcl.Forms,
Vcl.Graphics,
Vcl.StdCtrls,
Winapi.Messages,
Winapi.Windows,
UfrmKeymanBase,
UserMessages;

type
TfrmStartInstallNow = class(TfrmKeymanBase)
cmdInstall: TButton;
cmdLater: TButton;
lblUpdateMessage: TLabel;
lblUpdateNow: TLabel;
private
public
end;

implementation

{$R *.dfm}



end.
Loading
Loading