Skip to content

sync main#3267

Merged
ca333 merged 5 commits intomainfrom
dev
Oct 27, 2025
Merged

sync main#3267
ca333 merged 5 commits intomainfrom
dev

Conversation

@ca333
Copy link
Copy Markdown
Contributor

@ca333 ca333 commented Oct 27, 2025

Summary by CodeRabbit

  • New Features

    • Added file descriptor monitoring system that automatically tracks application resource usage, monitors key performance metrics, and provides detailed status reports with configurable monitoring intervals.
  • Improvements

    • Enhanced authentication and routing behavior during login and logout operations to ensure seamless wallet screen navigation and improved user experience.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces a file descriptor monitoring system with iOS native support and Flutter integration. It adds a FdMonitor singleton class, AppDelegate channel setup, and a Dart service layer for cross-platform FD status tracking and periodic logging with threshold-based alerting. Minor routing logic is added to login/logout flows.

Changes

Cohort / File(s) Summary
iOS FD Monitor Native Implementation
ios/Runner/AppDelegate.swift, ios/Runner/FdMonitor.swift
Introduces FdMonitor singleton class with periodic timer-based FD monitoring, status logging, and threshold detection. Adds MethodChannel registration in AppDelegate with handlers for start/stop/getCurrentCount/logDetailedStatus. Auto-starts in DEBUG builds with 60-second interval.
Flutter FD Monitor Service
lib/services/fd_monitor_service.dart
Creates FdMonitorService singleton with platform channel communication, error handling for PlatformException/MissingPluginException, and FdMonitorStats data class. Exposes start(), stop(), getCurrentCount(), logDetailedStatus(), and startIfDebugMode() methods with structured return maps.
UI Routing Updates
lib/views/main_layout/main_layout.dart
Adds listenWhen guard to BlocConsumer for auth state mode changes. On login, tracks via QuickLoginSwitch and routes to wallet menu. On logout, resets state and routes to wallet menu.

Sequence Diagram(s)

sequenceDiagram
    participant Flutter as Flutter App
    participant MethodChannel as MethodChannel<br/>(com.komodo.wallet/fd_monitor)
    participant AppDelegate as AppDelegate
    participant FdMonitor as FdMonitor

    Flutter->>MethodChannel: start(intervalSeconds: 60)
    MethodChannel->>AppDelegate: handleFdMonitorMethodCall("start")
    AppDelegate->>FdMonitor: start(intervalSeconds: 60)
    FdMonitor->>FdMonitor: createTimer() + logFileDescriptorStatus()
    FdMonitor-->>AppDelegate: success
    AppDelegate-->>MethodChannel: result
    MethodChannel-->>Flutter: success message

    loop Every 60 seconds (while running)
        FdMonitor->>FdMonitor: timer fires
        FdMonitor->>FdMonitor: getFileDescriptorInfo()
        FdMonitor->>FdMonitor: logFileDescriptorStatus(detailed: threshold check)
        Note over FdMonitor: If threshold crossed:<br/>log detailed FD breakdown
    end

    Flutter->>MethodChannel: stop()
    MethodChannel->>AppDelegate: handleFdMonitorMethodCall("stop")
    AppDelegate->>FdMonitor: stop()
    FdMonitor->>FdMonitor: cancelTimer()
    FdMonitor-->>AppDelegate: success
    AppDelegate-->>MethodChannel: result
    MethodChannel-->>Flutter: success message
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • FdMonitor.swift: Requires careful review of timer lifecycle, thread-safety with DispatchSourceTimer and private queue, and FD enumeration logic
  • fd_monitor_service.dart: Verify error handling patterns and FdMonitorStats parsing with safe defaults
  • AppDelegate.swift: Confirm channel naming and method routing are correct
  • main_layout.dart: Validate routing state changes during auth transitions

Possibly related PRs

  • KomodoPlatform/komodo-wallet#3262 — Directly implements the same iOS FD monitoring (AppDelegate channel setup, FdMonitor class) and Flutter service integration for file descriptor tracking

Suggested labels

QA

Suggested reviewers

  • CharlVS
  • gcharang
  • smk762

Poem

🐰 File descriptors hop and skip,
Through timers, logs, and channel-flip,
A monitor watches with watchful care,
When limits loom, an alert takes flight,
From iOS swift to Flutter bright! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd8c8f8 and 6befeb7.

📒 Files selected for processing (4)
  • ios/Runner/AppDelegate.swift (1 hunks)
  • ios/Runner/FdMonitor.swift (1 hunks)
  • lib/services/fd_monitor_service.dart (1 hunks)
  • lib/views/main_layout/main_layout.dart (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ca333 ca333 merged commit 162d169 into main Oct 27, 2025
5 of 12 checks passed
@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 6befeb7):

https://walletrc--pull-3267-merge-da83yn0q.web.app

(expires Mon, 03 Nov 2025 19:58:57 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants