@@ -69,8 +69,6 @@ Source: ".\start.sh"; DestDir: "{app}"; Flags: ignoreversion; Components: "Docke
6969Source : " .\delete.sh" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " Docker"
7070Source : " {#dockerMachineCli}" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " DockerMachine"
7171Source : " {#dockerComposeCli}" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " DockerCompose"
72- Source : " .\migrate.sh" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " DockerMachine"
73- Source : " .\migrate.bat" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " DockerMachine"
7472Source : " {#kitematic}\*" ; DestDir : " {app} \kitematic" ; Flags : ignoreversion recursesubdirs ; Components : " Kitematic"
7573Source : " {#b2dIsoPath}" ; DestDir : " {app} " ; Flags : ignoreversion ; Components : " DockerMachine" ; AfterInstall : CopyBoot2DockerISO()
7674Source : " {#git}" ; DestDir : " {app} \installers\git" ; DestName : " git.exe" ; AfterInstall : RunInstallGit(); Components : " Git"
@@ -98,7 +96,7 @@ Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"DOCKER_TOOLBOX_I
9896
9997var
10098 restart: boolean;
101- TrackingDisabled: Boolean;
99+ TrackingDisabled: Boolean;
102100 TrackingCheckBox: TNewCheckBox;
103101
104102function uuid (): String;
@@ -140,15 +138,20 @@ begin
140138 end ;
141139end ;
142140
143- procedure TrackEvent (name : String);
141+ procedure TrackEventWithProperties (name : String; properties : String);
144142var
145143 payload: String;
146144 WinHttpReq: Variant;
145+ tracking: String;
147146begin
148147 if TrackingDisabled or WizardSilent() then
149148 exit;
149+
150+ if Length(properties) > 0 then
151+ properties := ' , ' + properties;
152+
150153 try
151- payload := Encode64(Format(ExpandConstant(' {{"event": "%s", "properties": {{"token": "{#MixpanelToken}", "distinct_id": "%s", "os": "win32", "os version": "%s", "version": "{#MyAppVersion}"}}' ), [name , uuid(), WindowsVersionString()]));
154+ payload := Encode64(Format(ExpandConstant(' {{"event": "%s", "properties": {{"token": "{#MixpanelToken}", "distinct_id": "%s", "os": "win32", "os version": "%s", "version": "{#MyAppVersion}" %s }}' ), [name , uuid(), WindowsVersionString(), properties ]));
152155 WinHttpReq := CreateOleObject(' WinHttp.WinHttpRequest.5.1' );
153156 WinHttpReq.Open(' POST' , ' https://api.mixpanel.com/track/?data=' + payload, false);
154157 WinHttpReq.SetRequestHeader(' Content-Type' , ' application/json' );
@@ -157,9 +160,9 @@ begin
157160 end ;
158161end ;
159162
160- function NeedRestart (): Boolean ;
163+ procedure TrackEvent ( name : String) ;
161164begin
162- Result := restart ;
165+ TrackEventWithProperties( name , ' ' ) ;
163166end ;
164167
165168function NeedToInstallVirtualBox (): Boolean;
@@ -186,17 +189,6 @@ begin
186189 Result := not DirExists(' C:\Program Files\Git' ) or not FileExists(' C:\Program Files\Git\git-bash.exe' )
187190end ;
188191
189- procedure TrackingCheckBoxClicked (Sender: TObject);
190- begin
191- if TrackingCheckBox.Checked then begin
192- TrackingDisabled := False;
193- TrackEvent(' Enabled Tracking' );
194- end else begin
195- TrackEvent(' Disabled Tracking' );
196- TrackingDisabled := True;
197- end ;
198- end ;
199-
200192procedure InitializeWizard ;
201193var
202194 WelcomePage: TWizardPage;
@@ -211,11 +203,10 @@ begin
211203 TrackingCheckBox.Top := WizardForm.WelcomeLabel2.Top + WizardForm.WelcomeLabel2.Height + 10 ;
212204 TrackingCheckBox.Left := WizardForm.WelcomeLabel2.Left;
213205 TrackingCheckBox.Width := WizardForm.WelcomeLabel2.Width;
214- TrackingCheckBox.Height := 40 ;
206+ TrackingCheckBox.Height := 28 ;
215207 TrackingCheckBox.Caption := ' Help Docker improve Toolbox.' ;
216208 TrackingCheckBox.Checked := True;
217209 TrackingCheckBox.Parent := WelcomePage.Surface;
218- TrackingCheckBox.OnClick := @TrackingCheckboxClicked;
219210
220211 TrackingLabel := TLabel.Create(WizardForm);
221212 TrackingLabel.Parent := WelcomePage.Surface;
@@ -226,8 +217,8 @@ begin
226217 TrackingLabel.Visible := True;
227218 TrackingLabel.Left := WizardForm.WelcomeLabel2.Left;
228219 TrackingLabel.Width := WizardForm.WelcomeLabel2.Width;
229- TrackingLabel.Top := TrackingCheckBox.Top + TrackingCheckBox.Height + 20 ;
230- TrackingLabel.Height := 300 ;
220+ TrackingLabel.Top := TrackingCheckBox.Top + TrackingCheckBox.Height + 5 ;
221+ TrackingLabel.Height := 50 ;
231222
232223 // Don't do this until we can compare versions
233224 // Wizardform.ComponentsList.Checked[3] := NeedToInstallVirtualBox();
@@ -245,7 +236,13 @@ end;
245236function NextButtonClick (CurPageID: Integer): Boolean;
246237begin
247238 if CurPageID = wpWelcome then begin
248- TrackEvent(' Continued from Overview' );
239+ if TrackingCheckBox.Checked then begin
240+ TrackEventWithProperties(' Continued from Overview' , ' "Tracking Enabled": "Yes"' );
241+ TrackingDisabled := False;
242+ end else begin
243+ TrackEventWithProperties(' Continued from Overview' , ' "Tracking Enabled": "No"' );
244+ TrackingDisabled := True;
245+ end ;
249246 end ;
250247 Result := True
251248end ;
@@ -329,49 +326,6 @@ begin
329326 Result := true
330327end ;
331328
332- function MigrateVM () : Boolean;
333- var
334- ResultCode: Integer;
335- begin
336- if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant(' {app}\docker-machine.exe' )) then begin
337- Result := true
338- exit
339- end ;
340-
341- ExecAsOriginalUser(VBoxPath() + ' VBoxManage.exe' , ' showvminfo default' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode)
342- if ResultCode <> 1 then begin
343- Result := true
344- exit
345- end ;
346-
347- ExecAsOriginalUser(VBoxPath() + ' VBoxManage.exe' , ' showvminfo boot2docker-vm' , ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode)
348- if ResultCode <> 0 then begin
349- Result := true
350- exit
351- end ;
352-
353- TrackEvent(' Boot2Docker Migration Started' );
354- WizardForm.StatusLabel.Caption := ' Migrating Boot2Docker VM...'
355- WizardForm.FilenameLabel.Caption := ' This will take a minute...'
356- ExecAsOriginalUser(ExpandConstant(' {app}\docker-machine.exe' ), ExpandConstant(' rm -f default > nul 2>&1' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode)
357- DelTree(ExpandConstant(' {userdocs}\..\.docker\machine\machines\default' ), True, True, True);
358- ExecAsOriginalUser(ExpandConstant(' {app}\migrate.bat' ), ExpandConstant(' > {localappdata}\Temp\toolbox-migration-logs.txt 2>&1' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode)
359- if ResultCode = 0 then
360- begin
361- TrackEvent(' Boot2Docker Migration Succeeded' );
362- MsgBox(' Succcessfully migrated Boot2Docker VM to a Docker Machine VM named "default"' , mbInformation, MB_OK);
363- end
364- else begin
365- TrackEvent(' Boot2Docker Migration Failed' );
366- MsgBox(' Migration of Boot2Docker VM failed. Please file an issue with the migration logs at https://github.com/docker/toolbox/issues/new.' , mbCriticalError, MB_OK);
367- Exec(ExpandConstant(' {win}\notepad.exe' ), ExpandConstant(' {localappdata}\Temp\toolbox-migration-logs.txt' ), ' ' , SW_SHOW, ewNoWait, ResultCode)
368- Result := false
369- WizardForm.Close;
370- exit;
371- end ;
372- Result := true
373- end ;
374-
375329const
376330 ModPathName = ' modifypath' ;
377331 ModPathType = ' user' ;
@@ -390,6 +344,7 @@ begin
390344 Success := True;
391345 if CurStep = ssPostInstall then
392346 begin
347+ trackEvent(' Installing Files Succeeded' );
393348 if IsTaskSelected(ModPathName) then
394349 ModPath();
395350 if not WizardSilent() then
@@ -399,9 +354,6 @@ begin
399354 if CanUpgradeVM() then begin
400355 Success := UpgradeVM();
401356 end ;
402- // else begin
403- // Success := MigrateVM();
404- // end;
405357 end ;
406358 end ;
407359
0 commit comments