-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12079 from keymanapp/feat/windows/add-apply-now-u…
…pdate feat(windows): add state machine to control installation including apply now update 💽
- Loading branch information
Showing
29 changed files
with
1,822 additions
and
269 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
common/windows/delphi/general/Keyman.System.ExecutionHistory.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
windows/src/desktop/kmshell/main/BackgroundUpdateStateDiagram.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
47 changes: 47 additions & 0 deletions
47
windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.dfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
39 changes: 39 additions & 0 deletions
39
windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
61 changes: 61 additions & 0 deletions
61
windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.dfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
40 changes: 40 additions & 0 deletions
40
windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.