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

feat(geofence): Adds geofence plugin #442

Merged
merged 12 commits into from Aug 26, 2016
Merged

Conversation

amuramoto
Copy link
Contributor

@amuramoto amuramoto commented Aug 16, 2016

Closes #314

Supports all Cordova plugin functions except:

-onTransitionReceived()
-onNotificationClicked()

These functions require the base window.geofence object to be modified directly. See https://github.com/cowbell/cordova-plugin-geofence#listening-for-geofence-transitions

@amuramoto amuramoto mentioned this pull request Aug 17, 2016
@ihadeed
Copy link
Collaborator

ihadeed commented Aug 17, 2016

Why is there an edit in the camera preview plugin? is that there by accident?

@ihadeed
Copy link
Collaborator

ihadeed commented Aug 17, 2016

Also, we can do something like this for the two methods you mentioned

// add this to the top of the document
declare var window: any;

static onTransitionReceived(): Observable<any> {

return new Observable<any>((observer) => {
window.geofence.onTransitionReceived = observer.next.bind(observer);
return () => window.geofence.onTransactionReceived = undefined
// undefined can be replaced with ()=>{} .. whichever works better
});

}

@amuramoto
Copy link
Contributor Author

Oops must have cut the branch wrong. New commit reverts Camera Preview plugin for this branch to what's in master.

@amuramoto
Copy link
Contributor Author

@ihadeed I tried your suggestion for onTransitionReceived, but it returns a ZoneAwarePromise rather than an observer. Any advice?

@ihadeed
Copy link
Collaborator

ihadeed commented Aug 18, 2016

Are you using a Cordova decorator? You shouldn't use one

On Aug 17, 2016 5:59 PM, "Alex Muramoto" notifications@github.com wrote:

@ihadeed https://github.com/ihadeed I tried your suggestion for
onTransitionReceived, but it returns a ZoneAwarePromise rather than an
observer. Any advice?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#442 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANJ8dNMb1mLsKd5SpSoIEmKslijaQ721ks5qg4RYgaJpZM4JlzmA
.

@amuramoto
Copy link
Contributor Author

Removed the Cordova decorator. Function now returns the Observable, but the observer is never called.

@ihadeed
Copy link
Collaborator

ihadeed commented Aug 19, 2016

Can you provide a code sample of how you're calling the plugin?

On Aug 19, 2016 12:38 AM, "Alex Muramoto" notifications@github.com wrote:

Removed the Cordova decorator. Function now returns the Observable, but
the observer is never called.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#442 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANJ8dCFxRQZhqsWjV7zBRQR1kMtAs73gks5qhTM-gaJpZM4JlzmA
.

@amuramoto
Copy link
Contributor Author

Here's the plugin code:

static onTransitionReceived(): Observable<any> {

    return new Observable<any>((observer) => {
      window.geofence.onTransitionReceived = observer.next.bind(observer);
      return null;
      // undefined can be replaced with ()=>{} .. whichever works better
    });

  }

And here's the code calling it, which should update a data binding in the view, but does not appear to:

Geofence.onTransitionReceived().subscribe(()=>this.transited='TRANSITED');

@ihadeed ihadeed added this to the v1.3.18 milestone Aug 23, 2016
@ihadeed ihadeed merged commit a438967 into danielsogl:master Aug 26, 2016
@ihadeed
Copy link
Collaborator

ihadeed commented Aug 26, 2016

Just fixed them. When we provide custom code for a wrapper we can't use @Cordova decorator as it overrides any code in our function. Thank @amuramoto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants