strukturart / o.map

Open Street Map app - KaiOS
MIT License
81 stars 14 forks source link

Disabling simultaneous downloads for offline maps #29

Closed sonix-github closed 3 years ago

sonix-github commented 3 years ago

Hello John-David,

I tried to download open street maps for offline mode with max zoom level set at 16. I zoomed out to "10km" and then press # key to start downloading. During download I accidentally pressed again # key and noticed that download progress at top of the screen showed 2 different progresses but in the same position. Maybe it would be better to disable more then one download. And if there is logic that all visible area of the map is cached to preset zoom level in settings at the time you press key # it would be better to ask user if the map area is above "zoom level" 20 km and preset download zoom level is > 14 whether to start the download or not.

strukturart commented 3 years ago

please sideload the app again and test whether the error persists.

sonix-github commented 3 years ago

After sideload the app did not start. There is only green rotating compass on black background on the screen and that all. No version information is visible too. I tried twice to "uninstall" the app and repeat sideload but it nothing changed. Previous version is OK after sideload.

strukturart commented 3 years ago

oh yes a comma was missing, please try again

sonix-github commented 3 years ago

Thanks John-David. It is again functional and now I am testing it. It seems to be fixed :) Thanks for your great support

Best regards sonix

sonix-github commented 3 years ago

Hello John-David,

I found another bug. When the download is finished, another download can not be started (only after close and open the app again). I looked into the code and found typo in maps.js there is variable _caching_tilesstarted but few lines before it has another "name" status.caching_tiles_started .Could you please fix it.

Thanks in advance Best regards sonix

// Display seed progress on console
    tilesLayer.on("seedprogress", function (seedData) {
      status.caching_tiles_started = true;
      var percent =
        100 -
        Math.floor((seedData.remainingLength / seedData.queueLength) * 100);
      console.log("Seeding " + percent + "% done");

      document.querySelector("div#top-bar div.button-center").innerText =
        percent + "%";
    });
    tilesLayer.on("seedend", function (seedData) {
      document.querySelector("div#top-bar div.button-center").innerText =
        "Downloads finished";
      caching_tiles_started = false;
      setTimeout(() => {
        top_bar("", "", "");
      }, 2000);
    });
strukturart commented 3 years ago

apparently never fires tilesLayer.on("seedend", function (seedData)

I am now using another event to enable the download again.