Skip to content

[Q1 Quality] WearOS - Improve login flow#4949

Merged
sztomek merged 13 commits intomainfrom
fix/wearos-login-error-handling
Feb 11, 2026
Merged

[Q1 Quality] WearOS - Improve login flow#4949
sztomek merged 13 commits intomainfrom
fix/wearos-login-error-handling

Conversation

@sztomek
Copy link
Copy Markdown
Contributor

@sztomek sztomek commented Feb 4, 2026

Description

This PR improves the watch login sync experience by:

  1. Proper Error Propagation - Errors now flow from WatchSync through to the ViewModel and UI state
  2. Timeout Handling - Adds a 30-second timeout for initial connection to the phone
  3. Race Condition Fix - Prevents multiple concurrent sync operations from running simultaneously
  4. Retry Mechanism - Provides a retrySync() function for users to manually retry failed syncs
  5. Type-Safe State Management - Uses sealed interfaces to represent sync states (Idle, Syncing, Success, Failed)
  6. Comprehensive Testing - Adds unit tests for both WatchSync and WearMainActivityViewModel

This is the first part of the job focusing only on the logic pieces. UI will be updated in a subsequent PR.

Fixes PCDROID-408

Testing Instructions

Just review the code and make sure the pipeline is green

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@sztomek sztomek added this to the 8.6 milestone Feb 4, 2026
@sztomek sztomek added [Area] Login User login [Area] Wear OS watch app [Type] Enhancement Improve an existing feature. labels Feb 4, 2026
Copilot AI review requested due to automatic review settings February 4, 2026 21:09
@sztomek sztomek marked this pull request as ready for review February 4, 2026 21:10
@sztomek sztomek requested a review from a team as a code owner February 4, 2026 21:10
@sztomek sztomek requested review from geekygecko and removed request for a team February 4, 2026 21:10
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 improves the WearOS watch login synchronization flow by adding proper error handling, timeout mechanisms, and retry capabilities. The changes focus on the logic layer, with UI updates planned for a subsequent PR.

Changes:

  • Adds type-safe state management with sealed interfaces for sync states and errors
  • Implements a 30-second timeout for watch-to-phone connection attempts
  • Adds race condition prevention for concurrent sync operations
  • Provides comprehensive unit test coverage for WatchSync and WearMainActivityViewModel

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/ui/authentication/WatchSyncState.kt Defines sealed interfaces for sync states (Idle, Syncing, Success, Failed) and error types
wear/src/main/kotlin/au/com/shiftyjelly/pocketcasts/wear/WearMainActivityViewModel.kt Adds timeout handling, retry mechanism, and proper state management for watch sync
modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/watchsync/WatchSync.kt Improves error propagation with Result return type and exception handling
wear/src/test/kotlin/au/com/shiftyjelly/pocketcasts/wear/WearMainActivityViewModelTest.kt Adds unit tests for ViewModel sync functionality
modules/features/account/src/test/java/au/com/shiftyjelly/pocketcasts/account/watchsync/WatchSyncTest.kt Adds comprehensive unit tests for WatchSync error handling
modules/services/localization/src/main/res/values/strings.xml Adds localized strings for sync status messages and error states (for future UI work)

Copilot AI review requested due to automatic review settings February 5, 2026 11:50
@sztomek sztomek force-pushed the fix/wearos-login-error-handling branch from 3bae280 to 74d55b0 Compare February 5, 2026 11:50
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 6 out of 6 changed files in this pull request and generated 6 comments.

Copilot AI review requested due to automatic review settings February 5, 2026 15:20
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 8 out of 8 changed files in this pull request and generated 9 comments.

Copilot AI review requested due to automatic review settings February 6, 2026 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 10 out of 10 changed files in this pull request and generated 8 comments.

Copilot AI review requested due to automatic review settings February 10, 2026 13:13
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 11 out of 11 changed files in this pull request and generated 5 comments.

@sztomek sztomek merged commit 4bec299 into main Feb 11, 2026
24 checks passed
@sztomek sztomek deleted the fix/wearos-login-error-handling branch February 11, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Login User login [Area] Wear OS watch app [Type] Enhancement Improve an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants