Offline API nullability
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 {
}
}
})
}
Similar issue with SnapshotCallback:
public interface SnapshotReadyCallback {
void onSnapshotReady(MapSnapshot var1);
}
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.
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