GwtMaterialDesign / gwt-material

A Google Material Design wrapper for GWT
https://gwtmaterialdesign.github.io/gmd-core-demo/
Apache License 2.0
410 stars 124 forks source link

PushNotificationManager.subscribe() not working correctly after upgrade from 2.3.0 to 2.4.1 #999

Closed rwursthorn closed 3 years ago

rwursthorn commented 3 years ago

I implemented subscription for PushNotifications on Version 2.3.0. There it worked fine. After upgrading to Version 2.4.1 I don't get the subscription-information when calling PushNotificationManager.subscribe(boolean userVisibleOnly, String applicationServerKey, Functions.Func1 callback).

I noticed, that on this commit: https://github.com/GwtMaterialDesign/gwt-material/commit/f9745fa86c9d5b1b812ca4a0b6b376ff37521c0d?branch=f9745fa86c9d5b1b812ca4a0b6b376ff37521c0d&diff=unified you changed the following line from: getPushManager().subscribe(options).then(object -> { ... } to getPushManager().subscribe(options).then((e, object) -> { PushSubscription subscription = (PushSubscription) object; subscribed = subscription != null; callback.call(subscription); return true; });

So you added e. When I debug with Chrome developer tools I can see, that e is holding the subscription-information and object is undefined. But you still give object to the callback.

I think that the same problem will occur in the load and unsubscribe methods.

kevzlou7979 commented 3 years ago

This has been resolved on 2.5.0-SNAPSHOT.https://github.com/GwtMaterialDesign/gwt-material/blob/release_2.5.0/gwt-material/src/main/java/gwt/material/design/client/pwa/push/PushNotificationManager.java#L47