Change the default / first view at runtime


Amin Mousavi
Hi David,
We have a Cordova built app that we are expanding using AB. Our Cordova and AB apps communicate via local storage. Now in our AB app we have two views each providing a separate service for the original Cordova app. Depending on what cordova app requests via local storage, I want the proper view to open up. It is easy to switchview based on the received variable but the problem is, it always opens the first view after the master and then switches to the proper requested view that from user perspective it is a messy behaviour. So far I have thought of putting a blank view with a processing/loading sign in as the first view, so every time it switches over that view it looks nice enough. But the best way to handle it would be the ability to select the view AB app opens with. So is there a way that in app ready event tell AB which view to start with?
Thanks alot for your help.

decsoft

Hello Amin,

I understand what you wanted, however, I am not sure if we can got it. Let me to explain. AB allows to choose the first app's view in designtime, and then, in runtime, the appropriate "router" is prepared for the app. In that router AB specify the first view (and default view) according to designtime. Change that route code is possible, since it's in the app's code, but, change it programatically... it's another thing...

I want to continue thinking on that, but, before, please, can you try something that can may be useful? Try to use the "Animation" variable of the first view and also the others who can be loaded. Set this "Animation" to "fadeIn" in designtime. The intention of this is to get a better "view shown" for the user. But I am not sure if this can be solve exactly what you wanted.

On the other hand, maybe the required work (in order to modify the app's route in some way... if possible...), to be honest I don't see anything wrong in your approach: show the main app's view, which can simply shown some spinner or animated GIF or something like that, and then redirect to the user to the right app's view, maybe not automatically, so the user can see that something is loading... and then we load it.

Since maybe the "views change" can be a little abrupt, I suggest to use the "fadeIn" animation. If this is not enough for you, just post it here and maybe we can continue thinking in some possible way to deal with the app's router in runtime.



Amin Mousavi
Hi David,

Thanks a mill for your input and clarification. Good to know how it works, I also think as the first view gives the app a second to load all its elements and with addition of fade in, it is even better that way. Thanks a lot again :)

decsoft

Hello Amin,

I try some things here but without lucky yet. Just to remark something... maybe the main app's view can be shown for a couple of seconds... maybe the main app's view Show event must start a timer that, in a couple of seconds, redirect to the right other view. The point is that we let the main view a little in the screen, showing the animated GIF, the FontAwesome spinner, maybe a progress bar... something that solve the possible abrupt change between one view and another.



Amin Mousavi
Hi David,
Tried it with our app's splash screen and a gif loading and it works beautifully. Have not put a timer here yet, on the debugger it loads quickly but if we experience the same loading delay on the phone, I will put a timer there and add 1 second delay. Thanks for the tip David :)

decsoft

Hello Amin,

NO problem. I am happy to help when possible. :-)



decsoft

Hello Amin,

Please, upgrade your AB copy to the latest release. Take a look at the changes. With the new release of AB and their new stuff, it's possible to determine the default app's view at runtime. Take a look at the new "StartEvent" sample and tell me what do you think about. I hope that the new AB stuff can be useful for you and other customers too. :-)



Amin Mousavi

Hi David,

Great stuff, thanks a lot. I tried defaultview, very straight forward and serves our purpose very well!

Talking to my colleague this morning after finished the testing, you give your customers the feeling that they have a system specially made for them! thanks for the exceptional support David!


decsoft

Hello Amin,

Thanks for your kindly words! :-)


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.