mapbox-gl-native-android icon indicating copy to clipboard operation
mapbox-gl-native-android copied to clipboard

Offline API nullability

Open tobrun opened this issue 6 years ago • 3 comments

We are missing nullability annotations on the offline API callbacks. This makes it hard for it to be consumed from kotlin. For example:

OfflineManager.getInstance(rule.activity).createOfflineRegion(
        createTestRegionDefinition(),
        ByteArray(0),
        object : OfflineManager.CreateOfflineRegionCallback {
          override fun onCreate(region: OfflineRegion?) {
            // region will be non-null but we need to check it anyway
            region?.let {
                    
            }
          }
        })
    }

tobrun avatar Jul 05 '19 11:07 tobrun

Similar issue with SnapshotCallback:

  public interface SnapshotReadyCallback {
    void onSnapshotReady(MapSnapshot var1);
  }

tobrun avatar Jul 08 '19 09:07 tobrun

Capturing from @LukasPaczos that clients can however choose when consuming callbacks to indicate the null ability on their end. This mitigates the issue from OP. Adding nullability annotations is a semver major change and we need to wait for a major release before making this change.

tobrun avatar Jul 09 '19 07:07 tobrun

Hi there! Happy to see this is an open issue. Do you plan to add annotations to all offline-related API callbacks? It would be great! I'm talking about:

  • OfflineManager.ListOfflineRegionsCallback
  • OfflineManager.CreateOfflineRegionCallback
  • OfflineManager.MergeOfflineRegionsCallback
  • OfflineManager.PrefetchAmbientCacheCallback
  • OfflineRegion.OfflineRegionObserver
  • OfflineRegion.OfflineRegionStatusCallback
  • OfflineRegion.OfflineRegionDeleteCallback
  • OfflineRegion.OfflineRegionInvalidateCallback
  • OfflineRegion.OfflineRegionUpdateMetadataCallback

xit0c avatar Aug 28 '20 15:08 xit0c