maplibre / flutter-maplibre-gl

Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
https://pub.dev/packages/maplibre_gl
Other
215 stars 117 forks source link

Fix: missing render when coming back from background #364

Open dennisbordet opened 9 months ago

dennisbordet commented 9 months ago

What

Fix issue #327

Copied from commit on the google map flutter plugin. The commit concerned was fixing another fix that has inserted a second bug.

Test Plan

Tested on emulator API 28 & samsung Galaxy s7-> no more rendering missed when come back from background Tested on OnePlus 7T android 12 -> no regression seen

Dec-27-2023 16-18-06

Maestro Flow to reproduce bug

Run this flow with the following command: maestro test path_to_the_file Careful the flow does not check if the bug is present, just follow the steps to reproduce 15 times.

appId: ${APP_ID}
name: "Relaunch app"
env: 
      APP_ID: com.mapbox.mapboxglexample
---
# first launch
# CAREFUL, You may need to allow fine location permission on device first
- launchApp: 
        appId: ${APP_ID}
# open map
- tapOn: "Full screen map"

# Stop and launch app
- repeat: 
        times: 15
        commands: 
              - pressKey: home
              - launchApp: 
                      appId: ${APP_ID}
                      stopApp: false
              - waitForAnimationToEnd: 
                      timeout: 5000
dennisbordet commented 9 months ago

I just copied the code from the google maps plugin but in fact we just need to invalidate the texture view, not all the mapview

m0nac0 commented 8 months ago

Thanks for contributing!

It would be good if some more people who had the issue could test this approach and comment here, since I can't reproduce the original issue.

AurelienKun commented 8 months ago

Thanks for contributing!

It would be good if some more people who had the issue could test this approach and comment here, since I can't reproduce the original issue.

I tried on my Samsung Note8 (SM-N950F - Android 9) and the fix is working great !

T-moz commented 8 months ago

I can still reproduce the bug on my phone. It's a Samsung Galaxy s9, android 10

kuhnroyal commented 4 months ago

I can not reproduce this, can you let me know under which conditions this appears? Is this tied to a specific Android SDK version or are there already fixes in a later Flutter SDK?

f1sh1918 commented 4 months ago

What i've done to test:

  1. I forked your branch
  2. created a tag to be able to include it in my project. (Maybe there is an easier solution)
  3. added this to pubspec.yaml
  4. Also tested enabling impeller engine for android (added in manifest)
dependency_overrides:
    maplibre_gl_platform_interface:
      git:
        url: https://github.com/f1sh1918/flutter-maplibre-gl.git
        path: maplibre_gl_platform_interface
        ref: test
 dependencies:
   maplibre_gl:
    git:
      url: https://github.com/f1sh1918/flutter-maplibre-gl.git
      ref: test

For me the bug is still reproduceable on Android 9 and Android 14 even with your changes Tested on browserstack

environment:
  sdk: 3.3.1
  flutter: 3.19.3