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

feat: add set_badge_count for Linux, iOS; set_badge_label for Macos; set_overlay_icon for Windows #1002

Merged
merged 34 commits into from
Nov 5, 2024

Conversation

ahqsoftwares
Copy link
Contributor

This is a step further to implement tauri-apps/tauri#4489 into the main tauri crate

@ahqsoftwares ahqsoftwares requested a review from a team as a code owner October 31, 2024 08:40
Copy link
Contributor

github-actions bot commented Nov 4, 2024

Package Changes Through f84c710

There are 1 changes which include tao with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tao 0.30.5 0.30.6

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@ahqsoftwares
Copy link
Contributor Author

Fixing the macos and linux code issues...

src/platform_impl/android/ndk_glue.rs Outdated Show resolved Hide resolved
src/platform_impl/macos/event_loop.rs Outdated Show resolved Hide resolved
src/platform_impl/macos/window.rs Outdated Show resolved Hide resolved
src/platform_impl/windows/window.rs Outdated Show resolved Hide resolved
src/window.rs Outdated Show resolved Hide resolved
src/platform_impl/macos/event_loop.rs Show resolved Hide resolved
src/platform_impl/macos/window.rs Show resolved Hide resolved
src/window.rs Outdated Show resolved Hide resolved
src/event_loop.rs Outdated Show resolved Hide resolved
@ahqsoftwares ahqsoftwares changed the title feat: add set_badge_count for Linux and Macos; set_overlay_icon for Windows feat: add set_badge_count for Linux; set_badge_label for Macos; set_overlay_icon for Windows Nov 4, 2024
src/platform/macos.rs Show resolved Hide resolved
src/platform/unix.rs Show resolved Hide resolved
src/platform_impl/windows/window.rs Outdated Show resolved Hide resolved
@ahqsoftwares
Copy link
Contributor Author

What do we do about these warnings (linux)?

warning: use of deprecated associated function `gtk::glib::main_context_channel::<impl gtk::glib::MainContext>::channel`: Use an async channel, from async-channel for example, on the main context using spawn_future_local() instead
   --> src/platform_impl/linux/event_loop.rs:237:71
    |
237 |     let (window_requests_tx, window_requests_rx) = glib::MainContext::channel(Priority::default());     
    |                                                                       ^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `gtk::glib::main_context_channel::<impl gtk::glib::MainContext>::channel`: Use an async channel, from async-channel for example, on the main context using spawn_future_local() instead
   --> src/platform_impl/linux/event_loop.rs:251:55
    |
251 |       let (device_tx, device_rx) = glib::MainContext::channel(glib::Priority::default());
    |                                                       ^^^^^^^

warning: `tao` (lib) generated 2 warnings

@ahqsoftwares ahqsoftwares changed the title feat: add set_badge_count for Linux; set_badge_label for Macos; set_overlay_icon for Windows feat: add set_badge_count for Linux, iOS; set_badge_label for Macos; set_overlay_icon for Windows Nov 4, 2024
src/window.rs Outdated Show resolved Hide resolved
src/platform_impl/ios/event_loop.rs Show resolved Hide resolved
.changes/badge_count.md Outdated Show resolved Hide resolved
@ahqsoftwares
Copy link
Contributor Author

ahqsoftwares commented Nov 5, 2024

Somehow it auto fixed idk how and why.

Found why: the window needs to have an icon set for some reason?

@ahqsoftwares
Copy link
Contributor Author

@amrbashir Why is the Icon struct needed to be cloned inside the set_overlay_icon function?

@ahqsoftwares
Copy link
Contributor Author

nvm fixed it, Basically the Icon has to be borrowed for some unknown reason

@amrbashir
Copy link
Member

nvm fixed it, Basically the Icon has to be borrowed for some unknown reason

otherwise, it will be dropped and freeed

@ahqsoftwares
Copy link
Contributor Author

nvm fixed it, Basically the Icon has to be borrowed for some unknown reason

otherwise, it will be dropped and freeed

No issue, I made it to accept a borrowed Icon

@ahqsoftwares
Copy link
Contributor Author

image
that's strange

image

@amrbashir
Copy link
Member

there is also a missing import for macOS, not sure why iOS is failing though

@ahqsoftwares
Copy link
Contributor Author

there is also a missing import for macOS, not sure why iOS is failing though

I have no idea either

@ahqsoftwares
Copy link
Contributor Author

Both the examples under cfg of macos and ios are not applying. Do you have any idea why?

@ahqsoftwares
Copy link
Contributor Author

That commit should be it

@amrbashir
Copy link
Member

Thank you

@amrbashir amrbashir merged commit 1f72c24 into tauri-apps:dev Nov 5, 2024
9 checks passed
@github-actions github-actions bot mentioned this pull request Nov 2, 2024
@ahqsoftwares
Copy link
Contributor Author

Thanks a lot, I shall also PR to tauri crate to attach those apis to the tauri app

@ahqsoftwares
Copy link
Contributor Author

ahqsoftwares commented Nov 9, 2024

@amrbashir We'll implement the overlay label for Windows under a feature in the main tauri crate (it'll need the image crate, ab_glyph and imageproc crate as pointed out by @retrouser955 to me)

@amrbashir
Copy link
Member

we already depend on image crate but I don't know, seems like it would bloat the size of the app, let's just follow what electron did which is to provide two separate methods setBadgeCount for macOS and Linux and setOverlayIcon for Windows only.

@ahqsoftwares
Copy link
Contributor Author

Sure ! I shall work on a PR tomorrow

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