Skip to content

Commit

Permalink
InstallProgressScreen: more tweaks to ensure that the animated spinne…
Browse files Browse the repository at this point in the history
…r is displayed when tasks that don't report progress are running
  • Loading branch information
joshtynjala committed Jun 9, 2017
1 parent f204682 commit 4c95952
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion source/services/RunInstallerScriptService.as
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ package services
private static const MISSING_SCRIPT_ERROR:String = "Installation of the Feathers SDK failed. Cannot find SDK installer script.";
private static const UNKNOWN_ERROR:String = "Installation of the Feathers SDK failed due to an unexpected error.";

private static const DEFAULT_PROGRESS_LABEL:String = "Installing...";
private static const COPY_TASK_PROGRESS_LABEL:String = "Copying files...";
private static const GET_TASK_PROGRESS_LABEL:String = "Downloading file...";
private static const CHECKSUM_TASK_PROGRESS_LABEL:String = "Verifying checksum...";
Expand Down Expand Up @@ -201,12 +202,18 @@ package services

private function ant_progressHandler(event:ProgressEvent):void
{
var progressLabel:String = "Installing...";
var progressLabel:String = DEFAULT_PROGRESS_LABEL;
var progressValue:Number = Number.POSITIVE_INFINITY;
var progressClass:Object = this._ant.progressClass;
if(progressClass && event.bytesTotal !== 0)
{
progressValue = event.bytesLoaded / event.bytesTotal;
if(progressValue === 1)
{
//we're done with this task, we don't want to display
//progress anymore
progressValue = Number.POSITIVE_INFINITY;
}
}
if(progressValue < 1)
{
Expand Down
2 changes: 1 addition & 1 deletion source/view/InstallProgressScreen.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ limitations under the License.
import utils.CustomStyleNames;
[Bindable]
public var progressValue:Number = 0;
public var progressValue:Number = Number.POSITIVE_INFINITY;
[Bindable]
public var progressText:String;
Expand Down
2 changes: 1 addition & 1 deletion source/view/mediators/InstallProgressScreenMediator.as
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ package view.mediators
override public function onRegister():void
{
this.updateTitle();
this.screen.progressValue = 0;
this.screen.progressValue = Number.POSITIVE_INFINITY;
this.screen.progressText = null;
this.addContextListener(AcquireProductServiceEventType.START, context_acquireBinaryDistributionStartHandler);
this.addContextListener(AcquireProductServiceEventType.PROGRESS, context_acquireBinaryDistributionProgressHandler);
Expand Down

0 comments on commit 4c95952

Please sign in to comment.