fix: uri handling, ci test setup#4556
Merged
Merged
Conversation
This commit updates the `reusable-check.yml` GitHub Actions workflow to include unit tests (`testDebugUnitTest`) and instrumented tests (`connectedDebugAndroidTest`). Additionally, it refactors a constant by renaming `URL_PREFIX` to `CHANNEL_URL_PREFIX` in `ChannelTest.kt` for improved clarity. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit updates the `reusable-check.yml` GitHub Actions workflow to include unit tests (`testDebugUnitTest`) and instrumented tests (`connectedDebugAndroidTest`). Additionally, it refactors a constant by renaming `URL_PREFIX` to `CHANNEL_URL_PREFIX` in `ChannelTest.kt` for improved clarity. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
00e2edd to
69d1b3b
Compare
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Makes the parsing of `meshtastic.org` URLs more resilient to variations. - Ignores case when checking the URL host. - Handles fragments that may contain query parameters, which can be added by older Apple/web clients, by stripping them before decoding. - Adds more detailed error messages for invalid URLs. - Includes new unit tests for invalid paths and missing URL fragments. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
The `NDEF_DISCOVERED` action has been merged into the existing `VIEW` intent filter. This consolidates the handling for both NFC tag discoveries and standard URL views for `meshtastic.org` links into a single, more efficient filter. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This change enhances the parsing logic for Meshtastic shared contact URLs to be more lenient and robust. - Use bitwise `or` for combining Base64 flags, which is the correct operator for flag combinations. - Accommodate different Base64 encodings by using a more flexible decoder (`Base64.DEFAULT or Base64.URL_SAFE`). - Improve error messages for decoding failures to provide more specific context. Additionally, the corresponding unit tests have been updated to be more dynamic and less reliant on hardcoded URL strings. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
Refactors the `toSharedContact` extension function to improve URL validation and error handling. The logic is split into smaller, private functions (`checkSharedContactUrl` and `decodeSharedContactData`) for better clarity. Key changes: - Adds stricter checks for invalid Base64 and malformed Protobuf data within the URL fragment. - Throws `MalformedURLException` with the original exception as the cause for better debugging. - Adds unit tests to verify that invalid Base64 and Protobuf data correctly throw exceptions. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit introduces support for navigation-specific deep links. - A new `SharedFlow` is added to `UIState` to handle navigation deep link URIs. - `MainActivity` is updated to distinguish between standard Meshtastic URI actions and new navigation deep links, directing them to the new flow. - The `handleIntent` call in `onCreate` is now only triggered on initial creation (`savedInstanceState == null`) to prevent re-processing the intent on configuration changes. - `MainScreen` now observes the navigation deep link flow and uses the `navController` to navigate to the provided URI. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improvements to Meshtastic URL handling, NFC intent support, and test coverage for shared contacts. The main changes include refining URI parsing logic for shared contacts, consolidating NFC intent filters in the Android manifest, and expanding unit tests to cover invalid URL scenarios. Additionally, workflow scripts are updated to better control linting, unit, and instrumented test execution.
Improvements to Meshtastic URL handling and shared contact parsing:
toSharedContactinSharedContact.ktto improve host and path validation, handle fragments with query parameters, and provide more informative error messages when parsing fails.SharedContactTest.ktwith tests for invalid paths and missing fragments, ensuring exceptions are thrown for malformed URLs.URL_PREFIXtoCHANNEL_URL_PREFIXfor consistency inChannelTest.kt. [1] [2]Android manifest and NFC intent filter consolidation:
AndroidManifest.xml. [1] [2]Workflow script improvements:
.github/workflows/reusable-check.ymlto separately control linting and unit test tasks, and improved instrumented test task assignment based on flavor and API level. [1] [2]