Page 1 of 2

Saving state and data for user next use

Posted: Tue Feb 21, 2012 6:40 pm
by richsaw

Hi, I'm wondering how the state of a screen can be saved so that when a user next opens the app they will be directed to the last screen they were on and any data changed on that screen as they last viewed it?


Saving state and data for user next use

Posted: Tue Feb 21, 2012 6:42 pm
by maxkatz

You can save data in Local Storage or save data in mobile back-end such as Parse.com. Either way, when the last screen is loaded, you would read the values and display them on the screen Hope this helps..


Saving state and data for user next use

Posted: Wed Feb 22, 2012 8:16 pm
by richsaw

Thanks Max,

In this case I'd like a user to set the visibility of an image by clicking it.

To save this state do I then add an action to the click event that saves a local storage variable - in this case imagex 'visible'. Then on page load add an event that retrieves the local storage variable imagex 'visible' ?

Just wondering if I can test this in the web browser or whether I would need to move it to the mobile environment? I ask because I tried the above and was unable to see the result in web browser. - Although I haven't added any user-specific data that would remember that a particular user had made the particular change - I guess that is where parse.com would come in to create login credentials?


Saving state and data for user next use

Posted: Thu Feb 23, 2012 1:08 am
by maxkatz

[quote:]
To save this state do I then add an action to the click event that saves a local storage variable - in this case imagex 'visible'. Then on page load add an event that retrieves the local storage variable imagex 'visible' ?
[/quote]
Yes

[quote:]
Just wondering if I can test this in the web browser or whether I would need to move it to the mobile environment?
[/quote]
Yes, you can easily test in any browser.

[quote:]
Although I haven't added any user-specific data that would remember that a particular user had made the particular change - I guess that is where parse.com would come in to create login credentials?
[/quote]
Yes, one option is to use Parse. But maybe you don't have to, if it's one user per browser.


Saving state and data for user next use

Posted: Thu Feb 23, 2012 9:07 pm
by richsaw

Thanks Max, I'll have a play :)


Saving state and data for user next use

Posted: Thu Feb 07, 2013 3:21 pm
by New Mobile Guy

Can you clarify how exactly to save a variable or state to "local storage"? Is local storage something that's part of Tiggzi, or is this a jquery capability?

I need to be able to remember the user ID of the person who is using the app, so I can load in the right information from the backend data services.

Thanks!


Saving state and data for user next use

Posted: Thu Feb 07, 2013 3:33 pm
by Kateryna Grynko

Hello,

Local storage is a part of Tiggzi, this is for storing variables in your app.
For example, you can use actions to add local storage variable:
Image

I would also recommend you our docs http://docs.tiggzi.com


Saving state and data for user next use

Posted: Thu Feb 07, 2013 3:35 pm
by New Mobile Guy

Oh, ok. So to clarify, if the user leaves the app and comes back a week later, the value of that variable will be preserved? Or does it just save it during the current session?


Saving state and data for user next use

Posted: Thu Feb 07, 2013 3:40 pm
by Kateryna Grynko

It will be saved in constant localStorage (this is a usual variable) - it is not RAM.


Saving state and data for user next use

Posted: Thu Feb 07, 2013 8:53 pm
by Kateryna Grynko

Although Tiggzi builder provides a way to save data into local storage, actual local storage features is a standard browser feature. In the screen shot I posted, our builder allows saving data using the events wizard. However, you can use use the API directly from anywhere: codelocalStorage.setItem(value, name); localStorage.getItem(name); /code
More information on browser's local storage: https://developer.mozilla.org/en-US/d...