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

Add some features #58

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

DellZHackintosh
Copy link
Contributor

@DellZHackintosh DellZHackintosh commented Apr 17, 2024

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:

    • Badging API
      Every time a new notification comes, display a badge on the App icon.
    • Alerts when lost, restored network connection, a sw update is available & needs to refresh the app or the app is installable.
      Tell users something important is happening.
    • Make a simple cache logic to improve loading speed.
      Currently with no offline app experience, only cache files.
    • Custom offline page.
    • Kill switch for sw
      If admin disable this extension, it'll leave a sw. Open the kill switch to unregister the sw.
    • Allow to upload SVG image as app icon (size: any).

Related Needs

    • With a standalone WebSocket Server for real time updating.

@DellZHackintosh
Copy link
Contributor Author

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

@DellZHackintosh
Copy link
Contributor Author

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

@askvortsov1
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

DellZHackintosh commented May 2, 2024

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
Copy link
Owner

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

@DellZHackintosh
Copy link
Contributor Author

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
Copy link
Owner

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

@DellZHackintosh
Copy link
Contributor Author

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

@DellZHackintosh
Copy link
Contributor Author

DellZHackintosh commented Jul 5, 2024

Third stage.

@DellZHackintosh
Copy link
Contributor Author

DellZHackintosh commented Jul 5, 2024

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

  • Custom offline page
    When set the page to a fof's custom page and offline, Flarum will redirect to the homepage, dramatically reduced availability.
  • Allow to upload SVG image as app icon
    The upload feature depends on Intervention\Image, and it doesn't support SVG when with its default driver - GD.
    Replace its driver with Imagick can solve that, but unnecessary.
  • Use GoogleChromeLabs/pwacompat to support Apple splash screen
    Users can simply follow their instruction (adding a <script> to <head>) to have it.

Looking forward to implementing more.

@DellZHackintosh DellZHackintosh marked this pull request as ready for review July 5, 2024 09:58
@DellZHackintosh DellZHackintosh marked this pull request as draft July 6, 2024 07:51
@DellZHackintosh
Copy link
Contributor Author

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

@DellZHackintosh
Copy link
Contributor Author

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.

@DellZHackintosh DellZHackintosh marked this pull request as ready for review July 12, 2024 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants