Skip to content

fix: paired device removal and improve widget functionality#40

Merged
sirily11 merged 3 commits into
mainfrom
remove-device
May 21, 2026
Merged

fix: paired device removal and improve widget functionality#40
sirily11 merged 3 commits into
mainfrom
remove-device

Conversation

@sirily11

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 09:25
@vercel

vercel Bot commented May 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rxcode Ready Ready Preview, Comment May 21, 2026 10:09am

Request Review

@sirily11 sirily11 enabled auto-merge (squash) May 21, 2026 09:25
@autopilot-project-manager autopilot-project-manager Bot added bug Something isn't working enhancement New feature or request labels May 21, 2026
@sirily11 sirily11 disabled auto-merge May 21, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the mobile/desktop pairing UX and expands the widget/usage pipeline to include 7‑day utilization (notably for Codex), while also improving paired-device removal behavior.

Changes:

  • Add 7‑day usage fields (Claude Code + Codex) to widget data, push payloads, and UI rendering.
  • Make paired device/desktop removal “optimistic” (remove from UI immediately, then best-effort notify + disconnect).
  • Add local rename support and show paired relay host info in Settings UIs.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
RxCodeWidget/RxCodeWidgetData.swift Extends widget snapshot model to include weekly usage fields.
RxCodeWidget/RxCodeWidget.swift Renders both 5h and 7d usage bars; updates previews/placeholder data.
RxCodeMobile/Views/MobileSettingsView.swift Adds rename UI, shows relay host, and updates Codex usage display to 7-day.
RxCodeMobile/State/MobileAppState+Sync.swift Includes weekly usage in widget snapshot; makes unpair/removal optimistic.
RxCodeMobile/State/MobileAppState+Persistence.swift Persists relay URL and adds local rename for paired desktops.
RxCodeMobile/State/MobileAppState+Inbound.swift Records relay URL when pairing is accepted; logs relay info.
RxCodeMobile/State/MobileAppState.swift Adds relayURL + relayDisplayName to paired desktop model.
RxCodeMobile/AppDelegate.swift Applies weekly usage fields from background widget push payloads.
RxCode/Views/Settings/MobileSettingsTab.swift Adds rename UI and relay host display for paired mobile devices.
RxCode/Services/MobileSyncService+LiveActivity.swift Sends weekly usage in widget snapshot APNs payload.
RxCode/Services/MobileSyncService.swift Updates usage provider shape; optimistic unpair; adds rename + relay URL persistence.
RxCode/Services/CodexAppServer+Process.swift Updates logging to reflect 7-day usage.
RxCode/Services/CodexAppServer+Parsing.swift Parses 7-day Codex rate limit window and resets timestamp.
RxCode/App/RxCodeApp.swift Switches Codex secondary limit label/value to 7-day.
RxCode/App/AppState+Lifecycle.swift Provides weekly usage values to MobileSyncService widget snapshot provider.
Packages/Tests/RxCodeSyncTests/PayloadTests.swift Updates payload decoding expectations for Codex 7-day usage.
Packages/Sources/RxCodeSync/Protocol/Payload.swift Updates documentation to reflect Codex 7-day usage.
Packages/Sources/RxCodeSync/APNs/EncryptedAlert.swift Extends widget snapshot payload schema + initializer for weekly usage.
Packages/Sources/RxCodeChatKit/StatusLineView.swift Updates Codex UI segment from 24h to 7d usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +141 to +152
// 5-hour usage with solid bar
usageBarRow(
period: "5h",
percent: fiveHour,
barStyle: .solid
)
// 7-day usage with striped/dimmed bar
usageBarRow(
period: "7d",
percent: weekly,
barStyle: .dimmed
)
Comment on lines 291 to +298
/// Remove a paired device and notify it before forgetting its pubkey.
func unpair(_ device: PairedDevice) async {
try? await client.send(.unpair(UnpairPayload(reason: "desktop")), toHex: device.pubkeyHex)
pairedDevices.removeAll { $0.pubkeyHex == device.pubkeyHex }
let pubkeyHex = device.pubkeyHex

// Optimistically remove from UI first for immediate feedback
pairedDevices.removeAll { $0.pubkeyHex == pubkeyHex }
savePairedDevices()
subscribedSessions.removeValue(forKey: pubkeyHex)
Comment on lines +72 to 73
let sevenDay = windows.first { $0.durationMinutes == 10_080 }
?? windows.first { $0.durationMinutes != fiveHour?.durationMinutes }
var pairedAt: Date
var lastSeen: Date?
/// The relay server URL this desktop was paired through.
var relayURL: String?
@sirily11 sirily11 enabled auto-merge (squash) May 21, 2026 10:08
@sirily11 sirily11 merged commit c957506 into main May 21, 2026
7 checks passed
@sirily11 sirily11 deleted the remove-device branch May 21, 2026 10:14
@sirily11

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 1.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants