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

Commit 4ff52566 authored by Frank PREEL's avatar Frank PREEL
Browse files

Small fix to retry download automatically on failure (slow network)

parent 9d049cb5
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -46,6 +46,13 @@ import org.slf4j.LoggerFactory;
 * @author Vincent Bourgmayer
 * @author Vincent Bourgmayer
 */
 */
public class DownloadSrcController extends AbstractSubController {
public class DownloadSrcController extends AbstractSubController {
    /*
     * >1Go download may fail systematically (at least on MacOS)
     * Handle the retry (just one time) when detected to perform complete download without manual User action.
     */
    private static boolean automatic_retry_download = false;

    
    private final static Logger logger = LoggerFactory.getLogger(DownloadSrcController.class);
    private final static Logger logger = LoggerFactory.getLogger(DownloadSrcController.class);
    private @FXML ProgressBar preparationProgressBar;
    private @FXML ProgressBar preparationProgressBar;
    private @FXML Label progressLabel;
    private @FXML Label progressLabel;
@@ -195,8 +202,13 @@ public class DownloadSrcController extends AbstractSubController {
                //So here: it returns true if file is downloaded and checksum verified
                //So here: it returns true if file is downloaded and checksum verified
                if(! startNextDownload() ) onDownloadsComplete(); //if no more download to do, then preparation is over
                if(! startNextDownload() ) onDownloadsComplete(); //if no more download to do, then preparation is over
            }else{ //either download or checksum checks failed
            }else{ //either download or checksum checks failed
            	if (!automatic_retry_download) {
            		automatic_retry_download = true;
            		onTryAgainBtnClick();
            	} else {
            		displayErrorProgressBar(false);
            		displayErrorProgressBar(false);
            	}
            	}
            }
            super.succeeded(); //no sure of its use.
            super.succeeded(); //no sure of its use.
        }
        }