[android-auto] Check for world maps after init

Signed-off-by: Andrew Shkrob <andrew.shkrob.social@yandex.by>
This commit is contained in:
Andrew Shkrob 2024-12-27 15:00:41 +01:00 committed by Roman Tsisyk
parent 74aed8995e
commit 0c28dcbabd
2 changed files with 5 additions and 5 deletions

View file

@ -161,7 +161,11 @@ public final class CarAppSession extends Session implements DefaultLifecycleObse
mInitFailed = false;
try
{
MwmApplication.from(getCarContext()).init(() -> Config.setFirstStartDialogSeen(getCarContext()));
MwmApplication.from(getCarContext()).init(() -> {
Config.setFirstStartDialogSeen(getCarContext());
if (DownloaderHelpers.isWorldMapsDownloadNeeded())
mScreenManager.push(new DownloadMapsScreenBuilder(getCarContext()).setDownloaderType(DownloadMapsScreenBuilder.DownloaderType.FirstLaunch).build());
});
} catch (IOException e)
{
mInitFailed = true;
@ -178,9 +182,6 @@ public final class CarAppSession extends Session implements DefaultLifecycleObse
final List<Screen> screensStack = new ArrayList<>();
screensStack.add(new MapScreen(getCarContext(), mSurfaceRenderer));
if (DownloaderHelpers.isWorldMapsDownloadNeeded())
screensStack.add(new DownloadMapsScreenBuilder(getCarContext()).setDownloaderType(DownloadMapsScreenBuilder.DownloaderType.FirstLaunch).build());
if (!LocationUtils.checkFineLocationPermission(getCarContext()))
screensStack.add(new RequestPermissionsScreen(getCarContext(), mSensorsManager::onStart));

View file

@ -20,7 +20,6 @@ public final class DownloaderHelpers
@SuppressWarnings("ConstantConditions")
public static boolean isWorldMapsDownloadNeeded()
{
// TODO: Maps are asynchronously initialized in the core. If the initialization takes a significant amount of time, the downloader screen could potentially be displayed, even if the world maps are present.
if (BuildConfig.FLAVOR.equals("fdroid"))
return !CountryItem.fill(WORLD_MAPS[0]).present || !CountryItem.fill(WORLD_MAPS[1]).present;
return false;