askvortsov1 / flarum-pwa

Progressive Web App support for Flarum
MIT License
34 stars 12 forks source link

Add some features #58

Open DellZHackintosh opened 7 months ago

DellZHackintosh commented 7 months ago

This pull aims to add a set of new features to improve the users experience. The following features are currently planned to be added to this pull:

Related Needs

DellZHackintosh commented 6 months ago

@askvortsov1 How do you think of these features or have any other features are valuable to add?

DellZHackintosh commented 6 months ago

First stage: Added network and install alerts, badge and instant sw update support.

askvortsov1 commented 6 months ago

Planned changes sound good! Offline cache might be cool, but I also worry that this could be a deep dark rabbit hole.

One thing that people have reported that might be useful is better pusher / websockets refresh functionality with PWAs; iirc, on Discuss some people have complained that discussions don't automatically refresh / that there might not be a good mechanism for manually refreshing

DellZHackintosh commented 6 months ago

Planned changes sound good! Offline cache might be cool, but I also worry that this could be a deep dark rabbit hole.

One thing that people have reported that might be useful is better pusher / websockets refresh functionality with PWAs; iirc, on Discuss some people have complained that discussions don't automatically refresh / that there might not be a good mechanism for manually refreshing

I know, so they can only use 3rd-party pusher / websockets for now.

Currently with no offline app experience, only cache files.

Rest assured. For now I am planning to cache only forum.js, language files and forum.css, which are having a verison stamp to control the version (Example: /assets/forum.css?v=6b00d4ac). Because we don't cache html, so if the file updates, the link will update in time - we still always have the latest resources. Oh, one more thing, avatar and the uploaded files also have their unique URL, maybe they can be cached too.

DellZHackintosh commented 6 months ago

One thing that people have reported that might be useful is better pusher / websockets refresh functionality with PWAs;

One solution is using 3rd-party php extention, I found swoole and workerman. It needs further development, maybe will take more time to implement. Well, add this to the task list, though it's not actually dedicated to this.

askvortsov1 commented 5 months ago

Hey @DellZHackintosh! Should I review the current state of this PR?

DellZHackintosh commented 5 months ago

Hello @askvortsov1, thank you for your interest in the current state of this PR. Nevertheless, I'm preparing for my final exam, so I have to pause the development at this time. I'll continue on summer holiday. Appreciate again for your interest and understanding! 😊

askvortsov1 commented 4 months ago

No rush at all, thanks again for your contributions, and good luck with your exams!

DellZHackintosh commented 4 months ago

Second Stage: Kill switch, install alert, files cache and custom offline

DellZHackintosh commented 4 months ago

Third stage.

DellZHackintosh commented 4 months ago

How things work now

  1. Badging API image (Behavior depends on platform and browsers)
  2. Alerts when lost, restored network connection, a sw update is available & needs to refresh the app or the app is installable. image image image (When a sw update is available & needs to refresh the app, we also show a badge, behavior depends on platform and browsers) image (Available on Chrome, Edge & Opera with the ability to install, and Safari with the instruction. Has a bug that it'll appear again after dismissing and refreshing the page, but I can't find why) image (...So I added a switch, and it's disabled by default)
  3. Make a simple cache logic to improve loading speed.
  4. Kill switch for sw image

Features that cannot be completed for the time being

Looking forward to implementing more.

DellZHackintosh commented 4 months ago

Stage 4: The ability of customizing an offline page has been implemented. image

DellZHackintosh commented 4 months ago

Has a bug that it'll appear again after dismissing and refreshing the page, but I can't find why

Ok I realized that the "not configured" alert has the same bug on my side too, so it's may not my fault......Well, ship it now.