|
4 | 4 |
|
5 | 5 | Implementation of a comprehensive logging system for MostroP2P mobile app with in-memory capture, background isolate support, privacy sanitization, and export capabilities. |
6 | 6 |
|
| 7 | +## Implementation Phases |
| 8 | + |
| 9 | + |
| 10 | +### Phase 1: UI Components & Translations (Completed) |
| 11 | +- Logs screen with filtering (no share button yet) |
| 12 | +- Translations (EN, ES, IT) |
| 13 | +- Settings screen integration (Dev Tools section after Relays) |
| 14 | +- Logging toggle with performance warning |
| 15 | +- Toggle resets to OFF on every app restart (not persisted) |
| 16 | +- Route configuration |
| 17 | + |
| 18 | +### Phase 2: Logger Service & Integration (Current) |
| 19 | +- Logger service with memory buffer and sanitization |
| 20 | +- Riverpod providers |
| 21 | +- Initialize in main.dart |
| 22 | +- Connect UI to actual logger |
| 23 | +- Test with 2 files: RelaysNotifier, SubscriptionManager |
| 24 | + |
| 25 | +### Phase 3: Core Services Migration |
| 26 | +- NostrService |
| 27 | +- MostroService |
| 28 | +- DeepLinkService |
| 29 | +- 2 additional core files |
| 30 | + |
| 31 | +### Phase 4: Background Services |
| 32 | +- Mobile and desktop background service |
| 33 | +- Isolate logging |
| 34 | + |
| 35 | +### Phase 5: File Export & Persistence |
| 36 | +- Auto-save to storage |
| 37 | +- Restore on app restart |
| 38 | +- Generate .txt files |
| 39 | +- Folder picker and permissions |
| 40 | + |
| 41 | +### Phase 6: UI Enhancements |
| 42 | +- Recording indicator widget |
| 43 | +- Statistics and controls |
| 44 | + |
| 45 | +### Phase 7: Remaining Migrations |
| 46 | +- 25+ files with logs |
| 47 | + |
7 | 48 | ## Design Approach |
8 | 49 |
|
9 | 50 | ### Why This Architecture? |
@@ -114,41 +155,6 @@ void main() async { |
114 | 155 | } |
115 | 156 | ``` |
116 | 157 |
|
117 | | -### 4. Privacy Sanitization |
118 | | - |
119 | | -The `cleanMessage()` function automatically redacts: |
120 | | - |
121 | | -| Pattern | Replacement | Example | |
122 | | -|---------|-------------|---------| |
123 | | -| `nsec[0-9a-z]+` | `[PRIVATE_KEY]` | `nsec1abc...` → `[PRIVATE_KEY]` | |
124 | | -| `"privateKey":"..."` | `"privateKey":"[REDACTED]"` | JSON field redacted | |
125 | | -| `"mnemonic":"..."` | `"mnemonic":"[REDACTED]"` | Seed phrase redacted | |
126 | | -| ANSI codes | Removed | Color/formatting stripped | |
127 | | -| Emojis | Removed | All emoji ranges | |
128 | | - |
129 | | -### 5. File Storage & Permissions |
130 | | - |
131 | | -**Android/iOS**: |
132 | | -```dart |
133 | | -// External storage (requires permissions in future) |
134 | | -final directory = await getExternalStorageDirectory(); |
135 | | -final logsDir = Directory('${directory.path}/MostroLogs'); |
136 | | -``` |
137 | | - |
138 | | -**PERMISSIONS REQUIRED** (not yet implemented): |
139 | | -- Android: `WRITE_EXTERNAL_STORAGE` permission |
140 | | -- iOS: Automatic with app sandbox |
141 | | - |
142 | | -**Desktop/Web**: |
143 | | -```dart |
144 | | -// Application documents (no special permissions) |
145 | | -final directory = await getApplicationDocumentsDirectory(); |
146 | | -``` |
147 | | - |
148 | | -**Storage location display**: |
149 | | -- UI shows storage path to user |
150 | | -- Configurable via `Settings.customLogStorageDirectory` |
151 | | - |
152 | 158 | ## Migration Example |
153 | 159 |
|
154 | 160 | ### Service Integration |
@@ -196,8 +202,8 @@ void backgroundMain(SendPort sendPort) async { |
196 | 202 | } |
197 | 203 | ``` |
198 | 204 |
|
199 | | - |
200 | 205 | --- |
201 | 206 |
|
202 | | -**Version**: 1.0 |
203 | | -**Status**: Phase 1 - Planning Complete |
| 207 | +**Version**: 2 |
| 208 | +**Status**: Phase 2 - Ready |
| 209 | +**Last Updated**: 2026-01-06 |
0 commit comments