Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce pwa configs #323

Merged
merged 19 commits into from
Feb 5, 2024
Merged

introduce pwa configs #323

merged 19 commits into from
Feb 5, 2024

Conversation

charleslavon
Copy link
Contributor

@charleslavon charleslavon commented Jul 25, 2023

This PR introduces a new dependency, next-pwa, for some baseline caching configs with a service worker that regenerates upon each next build. The goal is to support a more native app feel for near.org.

With improved caching of static resources for an increased level of functionality when dropping in an out of network connectivity, and supporting a browser's default ability to prompt a user to install the app to their home screen.

@vercel
Copy link

vercel bot commented Jul 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
near-discovery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 4:56pm
near-discovery-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 4:56pm

@charleslavon charleslavon marked this pull request as ready for review October 24, 2023 21:09
@charleslavon charleslavon marked this pull request as draft October 24, 2023 21:48
@charleslavon
Copy link
Contributor Author

@erditkurteshiSQA Thanks for finding and fixing the async error in that fetch function. This PR is much closer now.

Screen Shot 2023-11-07 at 10 43 57 AM

I'll spend some time post-nearcon to optimize which files are cached, to ensure that the complied js is not cached, otherwise it will conflict with newly released components and dependencies.

@erditkurteshiSQA
Copy link
Contributor

@erditkurteshiSQA Thanks for finding and fixing the async error in that fetch function. This PR is much closer now.

Screen Shot 2023-11-07 at 10 43 57 AM I'll spend some time post-nearcon to optimize which files are cached, to ensure that the complied js is not cached, otherwise it will conflict with newly released components and dependencies.

Sounds good, let me know if you need anything else from my side on this one.

@charleslavon charleslavon changed the title introduce pwa configs for a more app-like feel on mobile browsers introduce pwa configs Nov 27, 2023
@charleslavon
Copy link
Contributor Author

@heycorwin @vanessadespain please checkout this preview build. This PR tells a browser client that near.org is an installable app. You should notice the download icon in the right side of your browser's URL field.

I've used The OS for an open web as the description here which is what users will see in several places instead of the website URL. What might you recommend?
Screen Shot 2024-01-26 at 2 18 00 PM
Screen Shot 2024-01-26 at 2 17 21 PM

@charleslavon
Copy link
Contributor Author

We should probably use a short description with Near in the name, since this text is what apps will used when navigating to installed apps by text
Screen Shot 2024-01-26 at 2 27 16 PM

@vanessadespain
Copy link

image Small detail, is it possible to detect Dark Mode vs Light mode and use the white logo for Dark Mode? Looks like my chrome browser shows the modal in Dark mode with a dark logo.

Re: Description, maybe NEAR — the OS for an open web

Is there any other flow we should follow to review? I just clicked the download icon in the URL field.

@charleslavon
Copy link
Contributor Author

thanks @vanessadespain i've updated it to match our website's current tag NEAR | The OS for an Open Web I'll look into darkmode.

Once you install the app. Try to search for it, open it, close it, etc. As you would another installed app like safari.

@charleslavon
Copy link
Contributor Author

@vanessadespain dark/light support for PWAs has not yet been formalized and is still under consideration. We'll have to revisit this later.

Copy link
Contributor

@jackson-harris-iii jackson-harris-iii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I installed the pwa on my device using the vercel link and the icon is a black square. Additionally the home page when not logged in is the near social feed, but that may be intentional?
IMG_5408
IMG_5409
IMG_5410

@charleslavon
Copy link
Contributor Author

thanks for testing @jackson-harris-iii Could you also try to enable push notifications on your mobile client and see if they are flowing correctly?

@jackson-harris-iii
Copy link
Contributor

thanks for testing @jackson-harris-iii Could you also try to enable push notifications on your mobile client and see if they are flowing correctly?

I was able to receive notifications, but did have some intermittent strange behavior.

  • I was presented with a double opt in; one from the website and one system.
  • My first account did not receive notifications. that said, I use here wallet and it was receiving notifications
  • Logging into another account (myNearWallet) I received notifications, but was presented with a 3rd opt-in (image w/purple square)
  • When logging out of the second account and back into the first account. While in the first account I was receiving notifications from the second account and not the first.
    IMG_5415
    IMG_5416
    IMG_5417

@charleslavon
Copy link
Contributor Author

really appreciate your help testing @jackson-harris-iii, thanks.
A few points and questions

  • What kind of mobile device are you using?
  • The double confirmation for push notifications is expected - our UI has a prompt which triggers the clients native confirmation prompt
  • did the black icon only show up when your device is in a Dark mode?

Thanks for calling out that the logged-out experience drops you into the activity feed. I'm going to push a couple updates to test options with multiple shortcut links.

@jackson-harris-iii
Copy link
Contributor

Glad to help @charleslavon!

  • I'm using an iPhone 15 pro max running iOS 17.2.1

  • I switched to light mode and that didn't change the existing icon. However, I changed my phone to light mode, deleted the pwa, and I re-installed it again while in light mode. This time the icon looks good. It also stayed the same icon when switching back from light mode to dark mode

@charleslavon charleslavon merged commit dfc87f1 into develop Feb 5, 2024
6 of 7 checks passed
@charleslavon charleslavon deleted the pwa branch February 5, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement To highlight a PR's description in the 'Enhancements' changelog section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants