Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ac5f826 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

add a updateProgressionBySuccess() method in Progression.java to update...

add a updateProgressionBySuccess() method in Progression.java to update progression status. There is probably a better way to do that but at the moment it's good enough
parent 6fc675d4
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
 */
package ecorp.easy.installer.models;

import ecorp.easy.installer.models.steps.IStep;

/**
 * this class encapsulate progression's data about both: preparation and flash of a given device
 * @author vincent
@@ -95,4 +97,20 @@ public class Progression {
    public void setPrepared(boolean prepared) {
        this.prepared = prepared;
    }
    
    public void updateProgressionBySuccess(){
        IStep step = getCurrentProcess().getSteps().get(this.currentStepKey);
        
        if (step.getNextStepKey().equals(Progression.LAST_STEP_KEY)){
            if(!this.prepared){
                prepared = true;
                currentStepKey = FLASHING_FIRST_STEP_KEY;
            }else if(!this.flashed){
                    flashed = true;
            }
            
        } else{
            currentStepKey = step.getNextStepKey();
        }
    }
}