Fuse 1.0.0 GPS not working and some more

Dear whoever it may concern,

I’ve been developing an app in Fuse for over 2 months now. I didn’t have any bigger issues that I couldn’t solve by trial-and-error or search trough documentation and forums up until Fuse 1.0.0.
When I updated to Fuse 1.0.0 from 0.37.0 without touching any code, several things stopped working.

First, GPS (geolocation) stopped returning any data, without any error in console log.
file

There you can see my code for requesting GPS location. The thing is, that this piece of code worked for previous version of Fuse, and now in console log I see ‘LATITUDE: undefined’; ‘LONGITUDE: undefined’; ‘ACCURACY: undefined’. Maybe I’m making some mistake, and I’d be very grateful if you could point me to the mistake, or at least reason why this doesn’t produce wanted results.

Another thing that stopped working is ActiveIndex of PageControl. I have created a ‘hack’ for date picker, since that function is not (was not) available in Fuse. So for each day/month/year/hour pages are created that are swiped up and down and by that selected wanted date. Below you can see code for that.

I wanted the default value of this ‘date picker’ to be current date, so in .js file I defined Observable variables (activeDay, activeMonth, activeYear, activeHour) to be current date/time. That worked until I updated Fuse to 1.0.0. So, is there now some other way to achieve what I want, or another way to write it down?

Thanks in advance and I hope there are solutions for my problems.

Hi Mirza,

I’m sorry to hear you’ve run into trouble and I hope we’ll manage solve all the issues. Let’s take it step-by-step.

First, it would be nice if you could give your code code a go on Fuse 1.0.1 which is now available on the QA downloads channel. This version includes a couple of fixes to known issues, so maybe that solves at least something for you.

Don’t forget to run uno clean and rebuild the preview/app after the installation.

Next, to validate / test / fix the problems, we would need to get our hands on complete, minimal reproductions. If you could isolate the failing code in a single-UX-file app, that would be best. If that is not possible, you can share the whole project with us privately on Dropbox.

Hi Uldis,

Thanks for fast reply! I have installed latest version, did uno clean and it still didn’t solve my issue. Unfortunately, I think I can’t isolate the failing code, but to simplify it - I need to get GPS location of the device and just after I get it, I need to use it in another function -> for testing purposes only thing that another function does is console.log(JSON.stringify(location));. For me, that returns undefined.
So if you could paste here working code, so I can use it or see the difference between it and mine, that would be great.

When it comes to the active index, it is pretty simple. ActiveIndex doesn’t work. Whichever number I put there, it shows first on the list.

The example code in docs is certainly working, so you could go from there. However, looking at the picture (why not paste the actual code?), it seems you’re not taking into account the reactive nature of Observables.

Specifically, continuousLoc is the result of a reactive .map() which gets calculated when the "changed" event on GeoLocation triggers. In your code, you resolve() it immediately, so it makes sense that it’s undefined at that point - it hasn’t been populated, or even created, yet.

To make it work, you need to attach a subscriber to the continuousLoc variable and react on it changing, for example:

continuousLoc.onValueChanged(module, function(x) {
    console.log("Location changed: " + JSON.stringify(x));
});

Now, if you need to put it inside of a Promise, I will need to leave that exercise with you. But the construct you have shown won’t work as you expect it to.

As for the ActiveIndex problem, there might be several causes. The first to check is if the data-bound variables are Observables, so that when they reactively change, the PageControl would transition. Another, a bit more complex cause might be that the PageControl gets rooted a moment after the Observables change, so it doesn’t pick up the new value - to work around that, you can add a Placed="{onPlaced}" callback on the PageControls and do something in JavaScript, like update the .value of the Observables.

As for the date pickers themselves, there’s this WIP effort that you might find useful.

All that said, blind debugging is neither fun, nor effective. If you need further assistance, you will have to provide minimal, complete reproductions or the whole project as suggested before.