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

fix: correct behaviors around single-target watch apps vs watch extensions to avoid crashes when targeting watchOS 8 and lower #179

Closed

Conversation

thedavidharris
Copy link
Contributor

Summary

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

…sions to avoid crashes when targeting watchOS 8 and lower
@@ -13,27 +13,57 @@
class WatchOSLifecycleMonitor: UtilityPlugin {
var wasBackgrounded: Bool = false

private var watchExtension = WKApplication.shared()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This wasn't referenced anywhere

}
} else if !isSingleTargetApplication {
switch notification.name {
case WKExtension.applicationWillEnterForegroundNotification:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Splitting this out is probably overkill but wanted to be extra safe around when WKApplication or WKExtension was referenced.

@thedavidharris
Copy link
Contributor Author

Unsure why this test is failing.

@crleona
Copy link
Collaborator

crleona commented Jun 11, 2024

@thedavidharris Thank you for the PR! I had started work on another request (#180) which solves an additional issue we had with tracking sessions and uses slightly simpler logic (as both WKApplication and WKExtension notifications have the same underlying rawValues and acted the same across the watchOS versions I tested). Closing this PR, but please let me know if you have a scenario that I missed that require the isSingleTargetApplication / watchOS 9.0 checks.

@crleona crleona closed this Jun 11, 2024
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