Skip to content

fix(#59): add crash reporting, detection and data recovery#490

Open
senmalong wants to merge 4 commits into
Smartdevs17:mainfrom
senmalong:fix/59-crash-reporting
Open

fix(#59): add crash reporting, detection and data recovery#490
senmalong wants to merge 4 commits into
Smartdevs17:mainfrom
senmalong:fix/59-crash-reporting

Conversation

@senmalong
Copy link
Copy Markdown
Contributor

Summary

Closes #59

Implements crash detection, user notification, data recovery, and crash logging — no third-party SDK required (uses AsyncStorage which is already a project dependency).

Files changed

src/services/crashReporter.ts (new)

  • Persists crash records to AsyncStorage across launches
  • Installs a global ErrorUtils handler to catch uncaught JS errors that escape React error boundaries
  • On next launch, detects whether the previous session crashed and returns the record
  • attemptDataRecovery() clears corrupted AsyncStorage state while preserving user settings and auth keys
  • Supports an optional remote reportingEndpoint for future Sentry/Crashlytics integration
  • Privacy-safe: stack traces are redacted from remote payloads; all data is local by default

src/components/CrashRecoveryModal.tsx (new)

  • Modal shown on launch when a previous crash is detected
  • "Recover Data" triggers crashReporter.attemptDataRecovery()
  • "Continue Without Recovering" dismisses and marks crash as notified (won't show again)
  • Shows debug info in __DEV__ mode

src/components/ErrorBoundary.tsx (updated)

  • componentDidCatch now calls crashReporter.recordCrash() so React render errors are persisted

App.tsx (updated)

  • Initializes crashReporter alongside i18n at startup
  • Detects previous crash and shows CrashRecoveryModal when needed

Acceptance Criteria

  • Crash detected on next launch
  • User notified of the issue via recovery modal
  • Data recovery attempted (corrupted AsyncStorage cleared, settings preserved)
  • Crash logged (persisted locally, optional remote endpoint)
  • Works on iOS and Android (uses Platform.OS aware APIs only)

senmalong added 4 commits June 1, 2026 07:41
autoFocus opens the keyboard immediately on mount, which can block
UI elements before the screen finishes rendering. Replace it with a
ref-based focus triggered after a 300 ms delay, giving the navigation
transition time to complete on both iOS and Android.

- Add nameInputRef (useRef<TextInput>) to the name field
- Remove autoFocus prop from the name TextInput
- Focus the input programmatically after 300 ms in a useEffect
- Import useRef from React
…lity tracking

- Switch KeyboardAvoidingView behavior to 'padding' on iOS and
  undefined on Android (Android handles scroll natively)
- Track keyboard show/hide events with Keyboard listeners to set
  isKeyboardVisible state
- Apply extra bottom padding to ScrollView content when keyboard is
  open so all form fields remain reachable
- Import Keyboard from react-native
- Add src/services/crashReporter.ts: persists crash records to
  AsyncStorage, installs a global ErrorUtils handler for uncaught JS
  errors, detects previous crash on next launch, and supports optional
  remote endpoint reporting
- Add src/components/CrashRecoveryModal.tsx: modal shown on launch
  when a previous crash is detected; lets user trigger data recovery
  or continue without recovering
- Update ErrorBoundary to call crashReporter.recordCrash() in
  componentDidCatch so React render errors are also persisted
- Initialize crashReporter early in App startup (alongside i18n)
- On launch, if a previous crash is detected, show CrashRecoveryModal
- handleRecover calls crashReporter.attemptDataRecovery() which clears
  corrupted AsyncStorage state while preserving settings and auth keys
- handleDismissRecovery marks the crash as notified so the modal does
  not reappear on subsequent launches
- Import Alert for recovery-failure feedback
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@senmalong Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

📱 Add crash reporting

1 participant