-
Notifications
You must be signed in to change notification settings - Fork 12
feat(edge-apps-library): introduce Hardware enum for typed device detection #593
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
Conversation
…screen is an Anywhere screen or not
PR Reviewer Guide 🔍(Review updated until commit 65772d6)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 65772d6
Previous suggestionsSuggestions up to commit 7d6cbf4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a helper function isAnywhereScreen() to determine whether a device is an Anywhere screen based on its hardware metadata property.
- Adds
isAnywhereScreen()utility function that checks if hardware is empty or undefined - Includes test coverage for the new function with two test cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| edge-apps/edge-apps-library/src/utils/metadata.ts | Adds the isAnywhereScreen() helper function that returns true when hardware metadata is empty string or undefined |
| edge-apps/edge-apps-library/src/utils/metadata.test.ts | Adds test suite for isAnywhereScreen() covering empty string and non-empty hardware scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
Persistent review updated to latest commit 65772d6 |
`screenly.metadata.hardware` only returns `undefined` for Anywhere screens.
…and remove isAnywhereScreen - Create Hardware enum with Anywhere, RaspberryPi, and ScreenlyPlayerMax values - Update getHardware() to return Hardware enum instead of string - Map hardware strings to enum values with proper validation - Throw error for unknown hardware types - Remove isAnywhereScreen() function in favor of direct enum comparison - Update all tests to use Hardware enum - Simplify and clarify hardware type checking
- Add Hardware enum documentation to metadata section - Include Hardware enum in types import example
- Import Hardware enum from @screenly/edge-apps - Update hardware check to use Hardware.Anywhere enum value - Improve clarity of Anywhere screen detection logic
PR Type
Enhancement, Tests
Description
Hardwareenum (Anywhere,RaspberryPi,ScreenlyPlayerMax) for type-safe device detectiongetHardware()to returnHardwareenum with validation and error handling for unknown typesHardwareenum APIDiagram Walkthrough
File Walkthrough
index.ts
Relax hardware field to string|undefinededge-apps/edge-apps-library/src/types/index.ts
hardwareto bestring | undefinedmetadata.ts
Add Anywhere detector and adjust hardware getteredge-apps/edge-apps-library/src/utils/metadata.ts
getHardwarereturn type tostring | undefinedisAnywhereScreenhelper usinggetHardwaremetadata.test.ts
Tests for Anywhere screen detection logicedge-apps/edge-apps-library/src/utils/metadata.test.ts
isAnywhereScreen