Skip to content

Fix/round2 p2 - #11

Merged
Yussefgafer merged 7 commits into
mainfrom
fix/round2-p2
Jul 1, 2026
Merged

Fix/round2 p2#11
Yussefgafer merged 7 commits into
mainfrom
fix/round2-p2

Conversation

@Yussefgafer

Copy link
Copy Markdown
Owner

No description provided.

Scope: 27 files changed (3 new), +246/-986 lines. Build verified.

Architecture & data layer:
- Inject IChatRepository instead of ChatRepositoryImpl in ChatViewModel
- Add Hilt NetworkModule to provision BleTransportImpl via DI
- Use shared replyScope + goAsync in ReplyReceiver (prevents process death)
- Consolidate 21 settings flows into single combine() in SettingsViewModel
- Unify parseName() via PeerNameParser utility

Code quality:
- Remove duplicate composeOptions from 7 build.gradle.kts files
- Consolidate ~150 duplicate and ~50 dead MD3E strings from strings.xml
- Create shared TimeUtils.formatMessageTime() replacing 3 duplicated formatters
- Delete stale Room schema files (v1-v3) from wrong package path

UI fixes:
- Replace hardcoded "Peer" with R.string.default_peer_name string resource
- Remove FLAG_SECURE from MainActivity (blocked accessibility + screenshots)
- 3 UI files now use shared TimeUtils for timestamp formatting
- BleTransportImpl: isAvailable lazy -> real-time BT check, fix peer ID bug, NPE on restart
- BleGattClient: effective MTU tracking (negotiated vs config), reject oversized chunks
- BleGattServer: stale entry cleanup by device name on reconnect (MAC randomization workaround)
- PendingMessageRepository: pendingCount/pendingMessages StateFlow, auto-retry on peer online
- FileManagerImpl: media dir creation moved to init
- IChatRepository: securityEvents marked with removal TODO
- Delete OobVerificationDialog + ViewModel (522 lines dead code, encryption removed)
- values-ar: +41 Arabic translations for BLE, transport, dialogs, badges
- .gitignore: add entries for worktrees, cascade dirs, AGENT.md
Add comprehensive unit tests for 7 repository implementations:

- ChatManagementRepositoryTest: chat CRUD, message deletion/forwarding
- FileManagerImplTest: file save/read operations, edge cases
- MessageAttachmentRepositoryTest: attachment save/retrieve/delete, grouped messages
- MessageRepositoryTest: text/image send, offline queuing, transport failures
- PendingMessageRepositoryTest: queue operations, retry with backoff
- ReactionRepositoryTest: add/remove/list reactions
- SettingsRepositoryTest: all preference read/write flows

Refactor production code for testability:
- MessageAttachmentRepository: inject ioDispatcher (default Dispatchers.IO)
- SettingsRepository: inject prefsStore DataStore (default context.dataStore)

Remove unused imports from 4 existing test files.
- Pollutes single test: remove File cleanup block in FileManagerImplTest
- Shared mutable state: remove unused callIndex in MessageAttachmentRepositoryTest
- Mock leakage: add unmockkAll() to MessageRepositoryTest @after
- Null-safety: replace getOrNull()!! with getOrThrow() in SettingsRepositoryTest
- Stale naming: rename copyMessageToChat test to forwardMessage delegation
@Yussefgafer
Yussefgafer merged commit 2c4de74 into main Jul 1, 2026
1 check failed
Yussefgafer added a commit that referenced this pull request Jul 31, 2026
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.

1 participant