Webstorage services Titanium / NG2

Forum to discuss the new web client version of Servoy.

Webstorage services Titanium / NG2

Postby john.makkink » Thu Aug 25, 2022 3:01 pm

I noticed that the Webstorage services doesn't do anything in Titanium client.
We use it to store the language key of users to show proper login page when they come back.

The following code works in NG1 but not in Titanium / NG2.
Code: Select all
function onAction(event) {
   plugins.webstorageLocalstorage.setItem('servoySample', 'some info...');
   
   var itemData = plugins.webstorageLocalstorage.getItem('servoySample');
   plugins.dialogs.showInfoDialog('', itemData);
}
john.makkink
 
Posts: 3
Joined: Thu Aug 25, 2022 2:46 pm

Re: Webstorage services Titanium / NG2

Postby jcompagner » Thu Aug 25, 2022 3:28 pm

why not use application.set/getUserProperty for that?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Webstorage services Titanium / NG2

Postby john.makkink » Thu Aug 25, 2022 4:18 pm

application.set/getUserProperty works like a charm in NG1 and Titanium so I will rewrite my code to use these functions.

The only reasons we used the Webstorage service where:
- Individual keys instead of 1 'big' object
- clear local storage with 1 function
john.makkink
 
Posts: 3
Joined: Thu Aug 25, 2022 2:46 pm

Re: Webstorage services Titanium / NG2

Postby jcompagner » Thu Aug 25, 2022 4:28 pm

we could potentially rewrite the impl

that we store it with the key prefixed (i really want that else you can adjust stuff that is not meant to be, or you overwrite a key which is used by something else on the client)
like user.properties.key = value

we could also add a clearUserProperties() if that is really often used. (And then if we would have separate keys we need to really find them)

But currently the plugins webstorage.clear() is really horrible if you ask me, that gives you the power to clear the whole thing, but you have no idea what angular or any of the angular components also maybe would have stored..
So if people think they just clear what they set with that plugin then they really are mistaken..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Webstorage services Titanium / NG2

Postby sean » Thu Aug 25, 2022 4:42 pm

I have added a feature request for the safe clearing of user properties
https://support.servoy.com/browse/SVY-17384

I have also archived / deprecated the local storage service extension.
It's functionality is otherwise duplicated by the Application functions and does an unsafe clear()

We will remove it from the package index, but it will still be accessible to download for compatibility reasons from the Git repo binary release.
https://github.com/Servoy/webstorage

Thanks for bringing this to our attention
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 3 guests