Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ios) fix build errors caused with cordova-ios@7 due to CDVCommandDel #2927

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: use latest renderer
EinfachHans committed Feb 18, 2022
commit 71d8d45286a451270518847f95a25e74ee7fa382
24 changes: 20 additions & 4 deletions src/android/plugin/google/maps/CordovaGoogleMaps.java
Original file line number Diff line number Diff line change
@@ -22,9 +22,13 @@
import android.view.ViewGroup;
import android.view.ViewTreeObserver;

import androidx.annotation.NonNull;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.MapsInitializer.Renderer;
import com.google.android.gms.maps.OnMapsSdkInitializedCallback;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
@@ -45,7 +49,7 @@
import java.util.Set;

@SuppressWarnings("deprecation")
public class CordovaGoogleMaps extends CordovaPlugin implements ViewTreeObserver.OnScrollChangedListener{
public class CordovaGoogleMaps extends CordovaPlugin implements ViewTreeObserver.OnScrollChangedListener, OnMapsSdkInitializedCallback {
private final String TAG = "GoogleMapsPlugin";
private Activity activity;
public ViewGroup root;
@@ -69,6 +73,8 @@ public void initialize(final CordovaInterface cordova, final CordovaWebView webV

pluginManager = webView.getPluginManager();

CordovaGoogleMaps that = this;

cordova.getActivity().runOnUiThread(new Runnable() {
@SuppressLint("NewApi")
public void run() {
@@ -202,17 +208,27 @@ public void onClick(DialogInterface dialog,int id) {
//------------------------------
if (!initialized) {
try {
MapsInitializer.initialize(cordova.getActivity());
initialized = true;
MapsInitializer.initialize(cordova.getActivity(), Renderer.LATEST, that);
} catch (Exception e) {
e.printStackTrace();
}
}

}
});
}


@Override
public void onMapsSdkInitialized(@NonNull Renderer renderer) {
initialized = true;
switch (renderer) {
case LATEST:
Log.d(TAG, "The latest version of the renderer is used");
break;
case LEGACY:
Log.d(TAG, "The legacy version of the renderer is used");
break;
}
}

@Override