Skip to content

Add AutoUpdater feature with events and facade support #570

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WINBIGFOX
Copy link
Contributor

Introduces the AutoUpdater class to manage update processes via the client. Adds events such as UpdateAvailable, UpdateDownloaded, and others for broadcasting update states. A facade is also provided for convenient usage.

PR:
NativePHP/electron: NativePHP/electron#213

Introduces the `AutoUpdater` class to manage update processes via the client. Adds events such as `UpdateAvailable`, `UpdateDownloaded`, and others for broadcasting update states. A facade is also provided for convenient usage.
Copy link
Member

@SRWieZ SRWieZ 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! Did you try it on your app?

@gwleuverink
Copy link
Contributor

Hey! Great addition 👍 what are your thoughts on adding a UpdateProgress event (or something like that) to a enable download progress indicator?

This event handles broadcasting download progress updates through a 'nativephp' channel. It includes details such as total size, delta, transferred bytes, percentage completed, and speed.
@WINBIGFOX
Copy link
Contributor Author

@SRWieZ yes I have tested this in my app. Here is a log excerpt:

\Native\Laravel\Events\AutoUpdater\UpdateAvailable

\Native\Laravel\Events\AutoUpdater\DownloadProgress {"total":121891223,"delta":60969106,"transferred":60969106,"percent":50.01927497273532,"bytesPerSecond":60969106}
\Native\Laravel\Events\AutoUpdater\DownloadProgress {"total":121891223,"delta":60922117,"transferred":121891223,"percent":100,"bytesPerSecond":62316576}

\Native\Laravel\Events\AutoUpdater\UpdateDownloaded {"version":"1.0.2","downloadedFile":"/Users/WINBIGFOX/Library/Caches/timescribe-updater/pending/TimeScribe-1.0.2-arm64.zip","releaseDate":"2025-04-25T19:38:08.061Z","releaseNotes":"

<span class="issue-keyword tooltipped tooltipped-se">Fixed <a class="issue-link js-issue-link" href="https://github.com/WINBIGFOX/TimeScribe/issues/7\">#7 Add optimize command and update filesystem config

Added an `optimize` Artisan command that immediately exits. Updated the filesystem configuration to simplify the public driver and removed default storage symlink settings. These changes aim to improve maintainability and streamline application behavior.

","releaseName":"v1.0.2"}

@gwleuverink I have added the DownloadProgress event

@SRWieZ SRWieZ requested a review from gwleuverink April 29, 2025 10:47
@WINBIGFOX
Copy link
Contributor Author

@SRWieZ Do you already know when you're planning a new release?

@SRWieZ
Copy link
Member

SRWieZ commented Apr 29, 2025

I don't know unfortunately. The team is also busy releasing v1 of NativePHP for mobile this week.

@gwleuverink
Copy link
Contributor

This is great! Are you up to write up something in the docs for this?

I also have some thoughts for discussion, doesn't have to block this PR.

Right now updates are downloaded automatically. Now we have a better api to handle this it might be worth adding a way to disable auto updates. I'm thinking by config and/or persisting the setting through a method on the AutoUpdater facade we can call in the service provider. Thoughts? @SRWieZ @WINBIGFOX

@gwleuverink
Copy link
Contributor

Or even disable auto updates altogether and let people handle it on boot themselves

@WINBIGFOX
Copy link
Contributor Author

@gwleuverink I can also write the documentation.

I don't think your suggestion to switch off the auto updates is a bad one. Especially if the user has deactivated the push notifications, he will not receive any information about an available update. I have also noticed in the app that users rarely restart their Mac or close the program. As a result, available updates are only rolled out very slowly.

In future, I will control the updates in my app myself so that this happens more reliably.

@SRWieZ
Copy link
Member

SRWieZ commented Apr 29, 2025

Right now updates are downloaded automatically. Now we have a better api to handle this it might be worth adding a way to disable auto updates. I'm thinking by config and/or persisting the setting through a method on the AutoUpdater facade we can call in the service provider. Thoughts? @SRWieZ @WINBIGFOX

I kinda forgot about docs but @WINBIGFOX if you can write a PR for all the recent changes would be great. A single PR is fine.

@gwleuverink absolutely! As someone that disable auto update because I'm working a lot on 4G/5G network, I would absolutely love that.

Adjusted the types of total, delta, and bytesPerSecond from float to int to ensure type consistency and accuracy. This change prevents potential precision issues and aligns with expected data formats.
@WINBIGFOX
Copy link
Contributor Author

@gwleuverink @SRWieZ Here is the PR for the docs

NativePHP/nativephp.com#112

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.

3 participants