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 action widgets, open page widgets, and gauges on the Lock Screen #2830

Merged
merged 32 commits into from
Jul 8, 2024

Conversation

literally-anything
Copy link
Contributor

@literally-anything literally-anything commented Jun 27, 2024

Summary

Allow action widget, open page widget, and watchOS style complications to be available on the iOS Lock Screen.

Screenshots

Screenshot 2024-06-30 at 9 28 19 AM Screenshot 2024-06-30 at 11 17 13 AM Screenshot 2024-06-30 at 9 29 26 AM

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @literally-anything

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@literally-anything literally-anything changed the title Add action and open page widgets on the Lock Screen Add action widgets, open page widgets, and gauges on the Lock Screen Jun 30, 2024
@literally-anything literally-anything marked this pull request as ready for review June 30, 2024 13:43
@literally-anything literally-anything marked this pull request as draft June 30, 2024 13:51
@literally-anything literally-anything marked this pull request as ready for review June 30, 2024 15:14
@bgoncal
Copy link
Member

bgoncal commented Jun 30, 2024

Looking good! I will manually test and review the PR this week

Copy link

codecov bot commented Jun 30, 2024

Codecov Report

Attention: Patch coverage is 7.21649% with 90 lines in your changes missing coverage. Please review.

Project coverage is 27.53%. Comparing base (6c34210) to head (7555425).
Report is 145 commits behind head on master.

Files Patch % Lines
...AppIntents/Widget/Gauge/WidgetGaugeAppIntent.swift 0.00% 37 Missing ⚠️
...Extensions/AppIntents/IntentServerAppEntitiy.swift 0.00% 26 Missing ⚠️
...ntents/Widget/Details/WidgetDetailsAppIntent.swift 0.00% 16 Missing ⚠️
...ficationCommands/NotificationsCommandManager.swift 12.50% 7 Missing ⚠️
.../SharedPush/Sources/NotificationParserLegacy.swift 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2830      +/-   ##
==========================================
- Coverage   27.54%   27.53%   -0.02%     
==========================================
  Files         311      357      +46     
  Lines       31699    24572    -7127     
==========================================
- Hits         8733     6767    -1966     
+ Misses      22966    17805    -5161     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bgoncal
Copy link
Member

bgoncal commented Jun 30, 2024

btw bundle exec fastlane autocorrect to fix lint issues

Copy link
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

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

Great job! Just some general improvements that I could spot

@home-assistant
Copy link

home-assistant bot commented Jul 1, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft July 1, 2024 09:31
@bgoncal
Copy link
Member

bgoncal commented Jul 1, 2024

You also need this code on line 81 in LegacyNotificationParserImpl, if you have time would be nice to make it all an enum

case "reload_widgets":
                return .init("reload_widgets")

@literally-anything
Copy link
Contributor Author

I haven’t managed to test the notification commands at all. I can’t seem to get my own firebase app connected to APNs properly.

@@ -19,6 +20,9 @@ public class NotificationCommandManager {
public init() {
register(command: "request_location_update", handler: HandlerLocationUpdate())
register(command: "clear_notification", handler: HandlerClearNotification())
if #available(watchOS 9, *) {
register(command: "reload_widgets", handler: HandlerReloadWidgets())
Copy link
Member

Choose a reason for hiding this comment

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

Use the created enum, this is a good example of where things could go wrong, now you are registering "reload_widgets" but on that enum is "update_widgets"

Copy link
Member

Choose a reason for hiding this comment

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

This is still incorrect

Copy link
Member

Choose a reason for hiding this comment

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

Also, let's remove the #available there and move this inside the #if os(iOS) on line 26, since it doesnt make sense to have it for watch anyways

@bgoncal
Copy link
Member

bgoncal commented Jul 3, 2024

Localization didn't work on my side, do you see it working fine when you edit the widget?

@bgoncal
Copy link
Member

bgoncal commented Jul 3, 2024

I haven’t managed to test the notification commands at all. I can’t seem to get my own firebase app connected to APNs properly.

I just manually tested it, and after the changes related to the enum above, all works well, we just need to add a note in the documentation telling the user that they can't keep reloading the widgets in a short period of time, since iOS will refuse to do it that often.

Btw, after these changes above we are good to merge, could you just update the docs?
https://companion.home-assistant.io/docs/notifications/notification-commands

repo:
https://github.com/home-assistant/companion.home-assistant

@literally-anything
Copy link
Contributor Author

Localization was working fine for me until I changed my locale. The localized string resources don’t seem to have a fallback for when the string isn’t in the current locale unless you explicitly set it, so I just added defaults for English.

literally-anything and others added 2 commits July 3, 2024 19:25
Copy link
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

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

LGTM!

@bgoncal
Copy link
Member

bgoncal commented Jul 8, 2024

Anything else you want to add? Otherwise I can merge it (Asking because you didnt hit the "ready to review" button)

@literally-anything literally-anything marked this pull request as ready for review July 8, 2024 11:06
@home-assistant home-assistant bot requested a review from bgoncal July 8, 2024 11:06
@literally-anything
Copy link
Contributor Author

Oh, no I just forgot to hit the button

@bgoncal bgoncal merged commit e364507 into home-assistant:master Jul 8, 2024
8 checks passed
@bgoncal
Copy link
Member

bgoncal commented Jul 8, 2024

Oh, no I just forgot to hit the button

Thank you for your contribution! Don't forget a small update in https://companion.home-assistant.io/docs/notifications/notification-commands

repo:
https://github.com/home-assistant/companion.home-assistant

@dnestico
Copy link

Sorry for commenting but just wondering if any documentation for these new widgets will be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants