Refactor media-projection/screenshot flow and photo-reasoning into modular components#64
Conversation
There was a problem hiding this comment.
This refactoring successfully improves code organization and maintainability by extracting responsibilities into focused, testable modules. The changes follow solid engineering principles and maintain functionality while making the codebase more modular. The PR is ready for merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
|
/q kannst du die branchs refactor-god-classes-in-/app gegen codex/analyze-technical-debt-and-complexity-o6bm9p vergleichen und sagen ob der Code tatsächlich wartbarer geworden ist? |
|
Ja, der Code ist deutlich wartbarer geworden. This PR extracts responsibilities from god classes (MainActivity and ScreenCaptureService) into 20+ focused, single-responsibility classes. The changes include extracting media projection intents, notification handling, storage operations, and permission checks into dedicated helpers, and splitting the large photo-reasoning feature into modular components. Key maintainability improvements:
The refactoring addresses technical debt by reducing class complexity and improving code organization. With 3009 additions and 2352 deletions across 41 files, the net increase reflects better structure rather than bloat. |
6ded619
into
codex/analyze-technical-debt-and-complexity-o6bm9p
Motivation
Description
MainActivityMediaProjectionIntents,MainActivityScreenshotIntents,MainActivityScreenshotFlowDecider,MainActivityStatusNotifier,NotificationPermissionPreferences,AccessibilityServiceStatusResolver,MainActivityBillingClientState,MainActivityBillingStateEvaluator,MainActivityScreenshotFlowDecider,ScreenCaptureNotificationFactory, andScreenCaptureStorage, then wiredMainActivityandScreenCaptureServiceto use them.MainActivity: centralized launch logic (launchCaptureIntent), foreground media-projection permission checks, clearer granted/denied handlers, and better flag reset behavior.ScreenCaptureServiceto useScreenCaptureStorageandScreenCaptureNotificationFactory, removed inline file IO/notification plumbing, and consolidated AI/network client responsibilities into dedicated files (ScreenCaptureVercelClient,ScreenCaptureApiClients, etc.).feature.multimodal: UI pieces (PhotoReasoningChatBubbles,PhotoReasoningPreviews,PhotoReasoningEntryEditor,DatabaseListPopup), view-model improvements (PhotoReasoningViewModelcleanup), chat/command pipeline utilities (PhotoReasoningHistoryBuilder,PhotoReasoningOpenAiStreamParser,PhotoReasoningScreenshotProcessor,PhotoReasoningScreenshotDebouncer,PhotoReasoningMessageMutations,PhotoReasoningCommandProcessing,PhotoReasoningCommandStateUpdater,PhotoReasoningCommandUiNotifier,PhotoReasoningCommandExecutionGuard, andPhotoReasoningScrollbar), DTOs for providers, and text/policy helpers (PhotoReasoningTextPolicies,TrialStateUiModelResolver).ScreenOperatorAccessibilityServiceby moving geometry resolution intoScreenCommandGeometryResolver, consolidating gesture dispatch with callbacks, adding availability checks, and centralizing scroll/tap handling; also added safer queue/async handling for commands.NotificationPermissionPreferencesandMainActivityStatusNotifierto centralize and simplify state access and user feedback.Testing
./gradlew assembleDebugand./gradlew test. The project built successfully and unit tests completed successfully.linton the changed modules (./gradlew lint) to catch obvious issues and fixed findings; no blocking lint errors remained.Codex Task