Skip to content

Commit

Permalink
Merge pull request #12621 from keymanapp/feat/windows/set-sm-idle-fir…
Browse files Browse the repository at this point in the history
…strun

feat(windows): set the update state machine to idle in first run 💽
  • Loading branch information
rc-swag authored Jan 7, 2025
2 parents 5cd439f + 26bbdf3 commit d47d2b8
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 268 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
object frmStartInstall: TfrmStartInstall
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Keyman Update'
ClientHeight = 225
ClientWidth = 425
ClientHeight = 142
ClientWidth = 322
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object lblInstallUpdate: TLabel
Left = 128
Top = 96
Width = 175
Left = 72
Top = 48
Width = 180
Height = 19
Caption = 'Keyman update available'
Caption = 'Keyman update available.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Expand All @@ -27,17 +30,17 @@ object frmStartInstall: TfrmStartInstall
ParentFont = False
end
object cmdInstall: TButton
Left = 228
Top = 184
Left = 140
Top = 104
Width = 75
Height = 25
Caption = 'Install'
ModalResult = 1
TabOrder = 0
end
object cmdLater: TButton
Left = 336
Top = 184
Left = 234
Top = 104
Width = 75
Height = 25
Caption = 'Close'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
object frmStartInstallNow: TfrmStartInstallNow
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Keyman Update'
ClientHeight = 225
ClientWidth = 425
ClientHeight = 164
ClientWidth = 354
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object lblUpdateMessage: TLabel
Left = 56
Top = 88
Width = 274
Height = 19
Caption = 'Keyman and Windows will be restarted'
Left = 32
Top = 48
Width = 290
Height = 41
Caption = 'Your computer will be restarted if you update now.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Expand All @@ -27,31 +30,18 @@ object frmStartInstallNow: TfrmStartInstallNow
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
Left = 147
Top = 120
Width = 75
Height = 25
Caption = 'Update'
Caption = 'Update now'
ModalResult = 1
TabOrder = 0
end
object cmdLater: TButton
Left = 336
Top = 184
Left = 247
Top = 120
Width = 75
Height = 25
Caption = 'Close'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ TfrmStartInstallNow = class(TfrmKeymanBase)
cmdInstall: TButton;
cmdLater: TButton;
lblUpdateMessage: TLabel;
lblUpdateNow: TLabel;
private
public
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ TRemoteUpdateCheck = class
property ShowErrors: Boolean read FShowErrors write FShowErrors;
end;

procedure LogMessage(LogMessage: string);

(**
* This function checks if a week or CheckPeriod time has passed since the last
* update check.
Expand All @@ -73,11 +71,13 @@ implementation
System.Win.Registry,
Winapi.Windows,
Winapi.WinINet,
Sentry.Client,

GlobalProxySettings,
KLog,
keymanapi_TLB,
KeymanVersion,
Keyman.System.KeymanSentryClient,
Keyman.System.UpdateCheckStorage,
kmint,
ErrorControlledRegistry,
Expand All @@ -103,7 +103,8 @@ constructor TRemoteUpdateCheck.Create(AForce: Boolean);
destructor TRemoteUpdateCheck.Destroy;
begin
if (FErrorMessage <> '') and FShowErrors then
LogMessage(FErrorMessage);
TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_ERROR,
'"+FErrorMessage+"');

KL.Log('TRemoteUpdateCheck.Destroy: FErrorMessage = ' + FErrorMessage);
KL.Log('TRemoteUpdateCheck.Destroy: FRemoteResult = ' +
Expand Down Expand Up @@ -223,13 +224,6 @@ function TRemoteUpdateCheck.DoRun: TRemoteUpdateCheckResult;
end;
end;

// temp wrapper for converting showmessage to logs don't know where
// if nt using klog
procedure LogMessage(LogMessage: string);
begin
KL.Log(LogMessage);
end;

function ConfigCheckContinue: Boolean;
var
Registry: TRegistryErrorControlled;
Expand Down Expand Up @@ -260,7 +254,8 @@ function ConfigCheckContinue: Boolean;
on E: ERegistryException do
begin
Result := False;
LogMessage(E.Message);
TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_ERROR,
E.Message);
end;
end;
end;
Expand Down
Loading

0 comments on commit d47d2b8

Please sign in to comment.