Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0b9ed3a authored by Fynn Godau's avatar Fynn Godau
Browse files

Less optimistic callback invocation

Never invoke onInitalized call back before onCreate
parent 71452df4
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -813,8 +813,13 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG
            if (initialized) {
                Log.d(TAG, "Invoking callback instantly, as map is initialized")
                runCallback()
            } else if (mapView?.isShown != true) {
                // If map is not shown, an app (e.g. Dott) may expect it to initialize anyway – before showing it
            } else if (mapView?.isShown == false) {
                /* If map is hidden, an app (e.g. Dott) may expect it to initialize anyway and
                 * will not show the map until it is initialized. However, we should not call
                 * the callback before onCreate is started (we know this is the case if mapView is
                 * null), otherwise that results in other problems (e.g. Gas Now app not
                 * initializing).
                 */
                Log.d(TAG, "Invoking callback instantly: map cannot be initialized because it is not shown (yet)")
                runCallback()
            } else {