docs: apply tight delta edits for correctness, resilience, and reviewer clarity

Implementation plan upgrades:
- Add timezone & manual clock change resilience: TimeChangeReceiver with TIME_SET/TIMEZONE_CHANGED
- Codify PendingIntent flags security: FLAG_IMMUTABLE vs FLAG_MUTABLE with examples
- Add notification posting invariants: channel validation and small icon requirements
- Clarify battery optimization UX limits: no ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS prompt
- Move MAX_RESPONSE_SIZE to config: Config.NETWORK_MAX_RESPONSE_SIZE with diagnostics inclusion
- Make Room migrations testable: fallbackToDestructiveMigration(false) test requirement
- Enforce event IDs in PR checklist: CI lint script validation for Log. calls
- Make degraded mode UI unmissable: visual badge + one-tap link to exact-alarm settings
- Add channelId snapshot to diagnostics: include channelId, importance, areNotificationsEnabled()
- Add manual clock skew test case: +10m clock move without timezone change

Analysis doc correctness polish:
- Add safe Application class example: show minimal <application> without android:name
- Show minimal BOOT_COMPLETED example: remove android:priority attribute
- Tighten WAKE_LOCK guidance: revisit only if introducing foreground services
- Mirror Cordova guard in Build Config: already present (no change needed)
- Add error surfaces to Mermaid flow: annotate @PluginMethod and Use Case Handler with → Canonical Error

All changes maintain existing structure with surgical precision edits for correctness, resilience, and reviewer clarity.
This commit is contained in:
Matthew Raymer
2025-10-24 11:05:18 +00:00
parent 0bef820d0c
commit aa53991a4b
2 changed files with 108 additions and 14 deletions

View File

@@ -128,6 +128,17 @@ public class MainActivity extends BridgeActivity {
> **Note:** Set `android:name` only if you provide a custom `Application` class; otherwise remove to avoid ClassNotFound at runtime.
**Safe default (no custom Application class):**
```xml
<application>
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
```
<!-- Plugin Components -->
<!-- Internal receiver: keep non-exported unless intentionally public -->
<receiver
@@ -149,6 +160,18 @@ public class MainActivity extends BridgeActivity {
</receiver>
> **Note:** `android:priority` has no practical effect for `BOOT_COMPLETED`; safe to omit.
**Minimal example (recommended):**
```xml
<receiver
android:name="com.timesafari.dailynotification.BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
```
</application>
<!-- Required Permissions -->
@@ -170,6 +193,8 @@ public class MainActivity extends BridgeActivity {
- `INTERNET`: Required for content fetching
- `RECEIVE_BOOT_COMPLETED`: Required for reboot recovery
> **Note:** If you later introduce foreground services, revisit WAKE_LOCK; otherwise keep it out.
### 3. Capacitor Configuration Files
#### capacitor.config.json
@@ -632,8 +657,8 @@ If **denied or quota-limited** → schedule via WorkManager (exp backoff + jitte
```mermaid
graph TD
A[JavaScript Call] --> B[Capacitor Bridge]
B --> C[@PluginMethod]
C --> D[Use Case Handler]
B --> C[@PluginMethod → Canonical Error]
C --> D[Use Case Handler → Canonical Error]
D --> E{Alarm vs WorkManager}
E -->|Exact Alarm| F[AlarmManager]
E -->|Fallback| G[WorkManager]