mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 918 forks source link

Gesture don't work #1868

Closed SelimTavukcuoglu closed 7 years ago

SelimTavukcuoglu commented 7 years ago

Thx for your plugin, it rox ! :)

But I've got a trouble.

I'm submitting a ... (check one with "x") [ ] question [ x] any problem or bug report [ ] feature request

If you choose 'problem or bug report', please select OS: (check one with "x") [ ] Android [ x] iOS

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.4.0 "Google Maps SDK for iOS" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-device 1.1.4 "Device" cordova-plugin-facebook4 1.9.1 "Facebook Connect" cordova-plugin-firebase 0.1.24 "Google Firebase Plugin" cordova-plugin-geolocation 2.4.3 "Geolocation" cordova-plugin-googlemaps 2.1.2-beta-20171102-2253 "cordova-plugin-googlemaps" cordova-plugin-inappbrowser 1.7.1 "InAppBrowser" cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview" cordova-plugin-keyboard 1.1.5 "Keyboard" cordova-plugin-mauron85-background-geolocation 2.3.1 "CDVBackgroundGeolocation" cordova-plugin-nativestorage 2.2.2 "NativeStorage" cordova-plugin-secure-storage 2.6.8 "SecureStorage" cordova-plugin-splashscreen 4.0.3 "Splashscreen" cordova-plugin-statusbar 2.2.3 "StatusBar" cordova-plugin-whitelist 1.3.1 "Whitelist" cordova-sqlite-storage 2.1.0 "Cordova sqlite storage plugin" cordova.plugins.diagnostic 3.7.1 "Diagnostic" ionic-plugin-keyboard 2.2.1 "Keyboard"

package.json::

{ "name": "Buyer-Mobile", "version": "0.0.1", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "lint": "ionic-app-scripts lint", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/common": "4.4.4", "@angular/compiler": "4.4.4", "@angular/compiler-cli": "4.4.4", "@angular/core": "4.4.4", "@angular/forms": "4.4.4", "@angular/http": "4.4.4", "@angular/platform-browser": "4.4.4", "@angular/platform-browser-dynamic": "4.4.4", "@ionic-native/background-geolocation": "^4.3.3", "@ionic-native/core": "4.3.2", "@ionic-native/device": "^4.3.3", "@ionic-native/diagnostic": "^4.3.3", "@ionic-native/facebook": "^4.3.3", "@ionic-native/firebase": "^4.3.3", "@ionic-native/geolocation": "^4.3.3", "@ionic-native/google-maps": "^4.3.3", "@ionic-native/in-app-browser": "^4.3.3", "@ionic-native/keyboard": "^4.3.3", "@ionic-native/native-storage": "^4.3.3", "@ionic-native/secure-storage": "^4.3.3", "@ionic-native/splash-screen": "^4.3.2", "@ionic-native/sqlite": "^4.3.3", "@ionic-native/status-bar": "^4.3.2", "@ionic/storage": "1.1.6", "cordova-plugin-compat": "^1.2.0", "cordova-plugin-device": "^1.1.4", "cordova-plugin-facebook4": "^1.9.1", "cordova-plugin-firebase": "^0.1.24", "cordova-plugin-geolocation": "^2.4.3", "cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps", "cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git", "cordova-plugin-inappbrowser": "^1.7.1", "cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-keyboard": "^1.1.5", "cordova-plugin-mauron85-background-geolocation": "^2.3.1", "cordova-plugin-nativestorage": "^2.2.2", "cordova-plugin-secure-storage": "^2.6.8", "cordova-plugin-splashscreen": "^4.0.3", "cordova-plugin-statusbar": "^2.2.3", "cordova-plugin-whitelist": "^1.3.1", "cordova-sqlite-storage": "^2.1.0", "cordova.plugins.diagnostic": "^3.7.1", "ionic-angular": "3.8.0", "ionic-plugin-keyboard": "^2.2.1", "ionicons": "3.0.0", "rxjs": "5.4.3", "sw-toolbox": "3.6.0", "zone.js": "0.8.18", "cordova-ios": "~4.5.3" }, "devDependencies": { "@ionic/app-scripts": "3.0.1", "typescript": "2.3.4" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-compat": {}, "cordova-plugin-device": {}, "cordova-plugin-facebook4": { "APP_ID": "257048978116059", "APP_NAME": "Buyer" }, "cordova-plugin-geolocation": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-keyboard": {}, "cordova-plugin-mauron85-background-geolocation": {}, "cordova-plugin-nativestorage": {}, "cordova-plugin-secure-storage": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-whitelist": {}, "cordova-sqlite-storage": {}, "cordova.plugins.diagnostic": {}, "ionic-plugin-keyboard": {}, "cordova-plugin-ionic-webview": {}, "cordova-plugin-firebase": {}, "cordova-plugin-googlemaps": { "API_KEY_FOR_ANDROID": "AIzaSyDcsHd9NXYjImeYAnilwbuAqZTzzFXl5mE", "API_KEY_FOR_IOS": "AIzaSyBQk52RDDBiNfFcQY0EXJRxLGlnLglq5rE", "LOCATION_WHEN_IN_USE_DESCRIPTION": "Activez le service de localisation pour accéder aux offres.", "LOCATION_ALWAYS_USAGE_DESCRIPTION": "Activez le service de localisation pour recevoir vos notifications d’offres." } }, "platforms": [ "ios" ] } }

Current behavior: The gesture dont work at all :(

Related code, data or error log (please format your code or data):

constructor(private app: App,
                private navCtrl: NavController,
                private platform: Platform,
                private navParams: NavParams,
                public storage: Storage,
                public events: Events,
                public geo: Geolocation,
                private dbOfferService: DbOfferService,
                private apiOfferService: ApiOfferService,
                private googleMaps: GoogleMaps,
                public toastCtrl: ToastController) {
        let self = this;
        this.googleMaps = googleMaps;

        platform.ready().then(() => {

            this.map = self.googleMaps.create('map', {
                //'styles': style
                'controls': {
                    'compass': true,
                    'myLocationButton': true,
                    'indoorPicker': true,
                    //'zoom': true
                },
                'gestures': {
                    'scroll': true,
                    'tilt': false,
                    'rotate': true,
                    'zoom': true
                }
            });
            this.map.setAllGesturesEnabled(true);
            events.subscribe('menu:opened', () => {
                this.map.setClickable(false);
                console.log('Map is not clickable');
            });
            events.subscribe('menu:closed', () => {
                this.map.setClickable(true);
                console.log('Map is clickable');
            });

            events.subscribe('offers:refreshed', () => {
                self.addMarkers(this.map);
            });

            this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
                this.map.setAllGesturesEnabled(true);
                this.map.setClickable(true);
                console.log('Map is ready!', this.map);
                self.mapReady = true;
                let toast = self.toastCtrl.create({
                    message: "Localisation en cours...",
                    duration: 30000
                });
                toast.present();
                this.map.clear();

                this.map.getMyLocation().then((location: MyLocation) => {
                    var myLatLng = location.latLng;
                    this.latitude = myLatLng.lat;
                    this.longitude = myLatLng.lng;
                    //this.storage.set('current_coords', {latitude: this.latitude, longitude: this.longitude})
                    console.log(this.latitude, this.longitude);
                    this.map.moveCamera({
                        'target': myLatLng,
                        'tilt': 0,
                        'zoom': 14
                    }).then(() => {
                        toast.dismiss();
                    });
                });

            });
        })
    }
wf9a5m75 commented 7 years ago

Please share your project files on github (ionic users are mandatory) because ionic is not only one page.

SelimTavukcuoglu commented 7 years ago

I've sent you (by email) an access to my personnal GitLab repository.

Please confirm you've received it. If you don't please check your spambox :)

You could clone my repo. Please clone the "devel" branche.

Thx.

wf9a5m75 commented 7 years ago

Thanks. I will check it tomorrow (It is midnight here)

wf9a5m75 commented 7 years ago

I just see your code.

https://gitlab.codeurfou.com/Buyer/Buyer-Mobile/blob/devel/src/pages/map/map.ts#L71

is ignored because it is executed before MAP_READY

SelimTavukcuoglu commented 7 years ago

Actually, I've tested to call it in several places.

https://gitlab.codeurfou.com/Buyer/Buyer-Mobile/blob/devel/src/pages/map/map.ts#L86 should not be ignored, right ?

wf9a5m75 commented 7 years ago

All methods before the MAP_READY event are ignored. After that, acceptable.

I don't know why you specify these options (I guess it's test)

'gestures': {
   'scroll': true,
   'tilt': false,
   'rotate': true,
   'zoom': true
}

I haven't built your project yet. Please wait. I do many things one by one.

SelimTavukcuoglu commented 7 years ago

No pb :)

wf9a5m75 commented 7 years ago

I can't build your project.

$> ionic cordova run android 
 ....
 ....
 ....
FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeDebugResources'.
> /Users/masashi/Documents/workspace2/test/Buyer-Mobile/platforms/android/res/values/strings.xml: Error: Found item String/google_app_id more than one time

* Try:
Run with 
--stacktrace option to get the stack trace. Run with --info or --debug
 option to get more log output.

BUILD FAILED

Total time: 14.668 secs
Error: /Users/masashi/Documents/workspace2/test/Buyer-Mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mergeDebugResources'.
> /Users/masashi/Documents/workspace2/test/Buyer-Mobile/platforms/android/res/values/strings.xml: Error: Found item String/google_app_id more than one time

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[ERROR] An error occurred while running cordova run android (exit code 1).
wf9a5m75 commented 7 years ago

ping

SelimTavukcuoglu commented 7 years ago

I succeded to build it for Android.

I needed to change version of cordova-plugin-compat to 1.2.*.

ghost commented 7 years ago

I also can confirm that gestures aren't working with MapsPlugin version 2.1.0! The Map looks like a static picture. You can't move or zoom, it's like frozen. With Version 2.0.0 there is no problem. I'm using Ionic 3.9.2

wf9a5m75 commented 7 years ago

If you have a problem, please share your project files.on github. Otherwise, I will close this thread.

SelimTavukcuoglu commented 7 years ago

I agree with @CONDACORE. With 2.0.0, it works well.

SelimTavukcuoglu commented 7 years ago

But I can't use 2.0.0 because the bug about hideInfoWindow() is not fixed in this version...

SelimTavukcuoglu commented 7 years ago

Maybe you need to test it on iOS ? Can you?

wf9a5m75 commented 7 years ago

@codeurfou Could you tell me the repository name you invited? I forgot it. (Many people invite me to private repo, so I can't find out which one is yours.)

SelimTavukcuoglu commented 7 years ago

Buyertech-Mobile

Le lun. 13 nov. 2017 à 18:21, Masashi Katsumata notifications@github.com a écrit :

@codeurfou https://github.com/codeurfou Could you tell me the repository name you invited? I forgot it. (Many people invite me to private repo, so I can't find out which one is yours.)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1868#issuecomment-343991583, or mute the thread https://github.com/notifications/unsubscribe-auth/AEkbBOygHA5oZW5vLNxorForuq-RwAxIks5s2Hp_gaJpZM4QViGQ .

--

Selim Tavukcuoglu

wf9a5m75 commented 7 years ago

That project does not contain cordova-plugin-compat plugin

wf9a5m75 commented 7 years ago

Wait...

SelimTavukcuoglu commented 7 years ago

Did you do a git pull ?

--

Selim Tavukcuoglu

wf9a5m75 commented 7 years ago
$ git pull
remote: The project you were looking for could not be found.
fatal: repository 'https://gitlab.codeurfou.com/Buyer/Buyer-Mobile.git/' not found
wf9a5m75 commented 7 years ago

I think you (or someone) removed my account from your repo.

SelimTavukcuoglu commented 7 years ago

Yes, my mistake. You can try now.

wf9a5m75 commented 7 years ago

Thanks, I pulled your latest code, and trying to build it.

SelimTavukcuoglu commented 7 years ago

OK, you have to use the devel branch and change package.json with the last version of your plugin (I used 2.0.0 in this version of package.json).

Thanks!

wf9a5m75 commented 7 years ago

Okay, I fixed the problem. Please reinstall the plugin from the multiple_maps branch. (I surprised such as complex css structure)

This is the demo screen record (due to the iPhone simulator, it's heavy) 1868-compressed

SelimTavukcuoglu commented 7 years ago

Thx a lot. But in this branch, the bug about marker.hideInfoWindow() is not fixed. Right ?