I’m excited

How do you maintain the current state of a PWA on iOS?

Currently the app reloads every time its called from the background on iOS, which then requires the user to login again. Reading several articles on the topic, there does appear to be some work arounds ( https://www.netguru.com/codestories/f... ), however not sure how to best implement something like this in Appery. Do you have any suggestions? I'm currently developing apps on the Ionic platform.

Note, this only impacts iOS, android platform function fine, they don't reload everything when the app loses focus.

Thanks

Btw, love the new PWA functionality. Has a ton of potential!
1 person has
this question
+1
Reply
  • Hi Sean,

    Yes, there is such limitation on iOS platform hopefully Apple will introduce a broader and more fully support of PWA in the future. We will look into this for a possible Appery.io workaround but I can't guarantee we will make this in the nearest time, definitely, we will put this on our to-do list.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Ok, thanks for the response Illya.

    One follow questions, are you aware of any methods that can be used to detect when the PWA app has gone to the background and/or come back from the background? For example some type an event listener?

    If I could detect when the app had gone to the background and/or come back from the background, specifically on the iOS platform, I could use localStorage to track the data points needed (sessionToken, last page visited, etc.) to re-establish the previous state of the app when it loads up again. Not ideal, but could certainly work in the short term.

    Thanks
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • FYI, found a work around for the above on iOS. Added some js code to the login page that checks if the platform is "iOS" and the session token, which is tracked in localStorage, is still valid (via an API Express Login call - if it's no longer active it will error out and direct the user to login again). If those statement are true, it will Navigate to the last page the user was on, which is also logged in localStorage.

    Not the most efficient of solutions, but seems to work for now.

    Thanks
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned