Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline Regions Empty after Restart App, IOS only #381

Open
GaelleJoubert opened this issue Feb 14, 2024 · 2 comments
Open

Offline Regions Empty after Restart App, IOS only #381

GaelleJoubert opened this issue Feb 14, 2024 · 2 comments
Labels
bug Something isn't working ios

Comments

@GaelleJoubert
Copy link
Contributor

GaelleJoubert commented Feb 14, 2024

Hello,
I am facing a (new?) issue about offline regions, but only in IOS.

tldr : The function getListOfRegions() return a empty list at the start of the app, even if we previously downloaded some regions in another session. This bug is only in IOS !!

At the start of the application, I am calling : getListOfRegions() function, to get all the previously downloaded Regions.

In Android, the Downloaded regions are saved even when the app is killed. For exemple, if I do the following actions :

1- Download the Region (A)
2- Wait for the download to be over
3- Kill the App
4- Open the App and call the function getListOfRegions()

On the 4th action, the function getListOfRegions() return the Region (A) as expected.

Now, if I do the exact same thing on IOS : on the 4th action, the function getListOfRegions() return an empty list !

I am pretty sure it used to work fine on IOS, but it's not anymore.

I tried to run the exemple App bpth on Android and IOS, but starting downloading a region makes the app crash (both IOS and Android ...). But still I have noticed something similar :

  • When I reopen the app on Android : it show me the region I tried to download as "dowloaded" (It offers me the option to delete it)
  • When I reopen the App on IOS : the region is not shown as "downloaded".

Has anyone encouter the same issue ?
I would be curious to know if someone mannage to use offline region in IOS in a way to still have them after killing the app.

@GaelleJoubert
Copy link
Contributor Author

GaelleJoubert commented Feb 15, 2024

[FIX]
I fixed my issue.

TLDR : I was calling getListOfRegions() too soon.

More detailed explaination :

I am using Provoider to save the list of downloaded Regions. My "SavedMapProvider" is instanciated at the very Root of my App, before Maplibre is ever called. The function getListOfRegions() is called at the init of the Provider. At that time, (only in IOS), it returns 0 at the start of the app.

I tried to call the function later :
In the InitState of the page were the offline map are displayed.
Even there, If I call the functiun straigh away, it still return an empty list, but if I add a delaly of 500ms, this time, it worked !!

The weird thing is that I do not face this issue with Android.
I am also pretty sure that the behavior changed, and it use to work in IOS as well.

Knowing the fix, the issue was not that bad, but I guess maybe it is worth adding a little note in the Read Me, to avoid other a loooong time of debegging. (It took me a little bit more than a day to figure it out).
What do you think @m0nac0 should I do a PR to edit the read me ?

@m0nac0
Copy link
Collaborator

m0nac0 commented Mar 3, 2024

Maybe better add a note to the doc comment of getListOfRegions() in the dart code, to avoid the Readme getting to cluttered, and also since others with the same problem will/should probably look there, what do you think?

@josxha josxha added bug Something isn't working ios labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios
Projects
None yet
Development

No branches or pull requests

3 participants