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

[Voice to Content] Error logging, tracking, and error state #20979

Merged
merged 13 commits into from
Jun 13, 2024

Conversation

zwarm
Copy link
Contributor

@zwarm zwarm commented Jun 13, 2024

Addresses

This PR implements the following Voice To Content

  • Adds a helper class for logging and tracking throughout the flow
  • Creates specific Failure results for PrepareVoiceToContentUseCase and VoiceToContentUseCase
  • Log error results from API calls and audio recording
  • Track events
  • Launch upgrade URL in external browser when out of credits

Note

The following have not yet been implemented
waveform
recording timer
orientation changes
landscape view
Overall polishing of the UI
Launch Edit Post


To Test:

The testing will focus on tracking

  • Install the JP from the device
  • Login and select a site that does not have AI credits
  • Navigate to Me > App Settings > Privacy settings > Enable collect information
  • Navigate to Me > Debug Settings
  • Enable the voice-to-content feature flag and restart the app (option is in the more menu of the debug settings view)
  • Navigate to My Site for the site with no AI credits
  • Tap the FAB and select the Post from audio option to launch the Post From Audio bottom sheet
  • βœ… Validate the log contains the following entries:
    πŸ”΅ Tracked: my_site_create_sheet_action_tapped, Properties: {"action":"create_new_post_from_audio"}
    πŸ”΅ Tracked: voice_to_content_sheet_shown
    πŸ”΅ Tracked: voice_to_content_button_recording_limit_reached
  • Tap the upgrade link to launch the upgrade in an external browser
  • Navigate back to the app
  • βœ… Validate the log contains πŸ”΅ Tracked: voice_to_content_button_upgrade_tapped
  • Tap the close button
  • βœ… Validate the log contains πŸ”΅ Tracked: voice_to_content_button_close_tapped
  • Navigate to a site that has AI credits
  • Tap the FAB and select the Post from audio option to launch the Post From Audio bottom sheet
  • βœ… Validate the log contains the following entries:
    πŸ”΅ Tracked: my_site_create_sheet_action_tapped, Properties: {"action":"create_new_post_from_audio"}
    πŸ”΅ Tracked: voice_to_content_sheet_shown
  • Tap the microphone icon and record some audio
  • Tap the done icon when finished (note - the bottom sheet will close - the edit post will not launch yet)
  • βœ… Validate the log contains the following entries:
    πŸ”΅ Tracked: voice_to_content_button_start_recording_tapped
    πŸ”΅ Tracked: voice_to_content_button_done_tapped

Regression Notes

  1. Potential unintended areas of impact
    The track events are not tracked

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manual tested

  3. What automated tests I added (or what prevented me from doing so)
    N/A


PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones): N/A

@dangermattic
Copy link
Collaborator

dangermattic commented Jun 13, 2024

5 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ Class Failure is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class VoiceToContentResult is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class Success is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

Copy link

sonarcloud bot commented Jun 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@wpmobilebot
Copy link
Contributor

JetpackπŸ“² You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20979-028cb1e
Commit028cb1e
Direct Downloadjetpack-prototype-build-pr20979-028cb1e.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

WordPressπŸ“² You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20979-028cb1e
Commit028cb1e
Direct Downloadwordpress-prototype-build-pr20979-028cb1e.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 8.25688% with 100 lines in your changes missing coverage. Please review.

Project coverage is 40.75%. Comparing base (756cbd8) to head (028cb1e).
Report is 7 commits behind head on trunk.

Files Patch % Lines
...droid/ui/voicetocontent/VoiceToContentViewModel.kt 11.86% 52 Missing ⚠️
...android/ui/voicetocontent/VoiceToContentUseCase.kt 0.00% 22 Missing ⚠️
.../ui/voicetocontent/PrepareVoiceToContentUseCase.kt 0.00% 11 Missing ⚠️
...droid/ui/voicetocontent/VoiceToContentTelemetry.kt 0.00% 6 Missing ⚠️
.../android/ui/voicetocontent/VoiceToContentScreen.kt 0.00% 4 Missing ⚠️
...android/ui/voicetocontent/VoiceToContentUiState.kt 33.33% 4 Missing ⚠️
...java/org/wordpress/android/ui/ActivityNavigator.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #20979      +/-   ##
==========================================
- Coverage   40.79%   40.75%   -0.04%     
==========================================
  Files        1527     1528       +1     
  Lines       70079    70158      +79     
  Branches    11588    11603      +15     
==========================================
+ Hits        28589    28596       +7     
- Misses      38900    38972      +72     
  Partials     2590     2590              

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@kean
Copy link

kean commented Jun 13, 2024

Verified the changes according to the instructions. Looks good, but two comments:

  • voice-to-content FF was already enabled when I opened "Debug Settings" I logged in with my personal account (not P2/A8C)
  • The layout on the "Upgrade needed" screen looks a bit off
  • "error+retry" view is also not center.

@@ -25,6 +30,10 @@ class VoiceToContentUseCase @Inject constructor(
file: File
): VoiceToContentResult =
withContext(Dispatchers.IO) {
if (!networkUtilsWrapper.isNetworkAvailable()) {
Copy link

Choose a reason for hiding this comment

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

Is it common on Android to stop the request without sending it in case the app thinks network is unavailable. On iOS, it's considered a bad practice because the respective API usually lags behind the real status a bit and is not always accurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kean - yes, this is the way it's done on Android. Something perhaps for the future app team to align?

@kean kean self-requested a review June 13, 2024 18:35
@zwarm
Copy link
Contributor Author

zwarm commented Jun 13, 2024

Verified the changes according to the instructions. Looks good, but two comments:

  • voice-to-content FF was already enabled when I opened "Debug Settings" I logged in with my personal account (not P2/A8C)

That's odd indeed. Postman returns false for anything under 25.2. I'll see if it's set internally somewhere.

  • The layout on the "Upgrade needed" screen looks a bit off

The entire layout needs to be polished. 😜

Thanks for the feedback!

@zwarm zwarm merged commit 10b3bb3 into trunk Jun 13, 2024
22 checks passed
@zwarm zwarm deleted the issue/v2c-error-logging-tracking branch June 13, 2024 18:54
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.

None yet

4 participants