Skip to content

RE1-T123 Modern notification sounds#252

Merged
ucswift merged 1 commit into
masterfrom
develop
Jun 30, 2026
Merged

RE1-T123 Modern notification sounds#252
ucswift merged 1 commit into
masterfrom
develop

Conversation

@ucswift

@ucswift ucswift commented Jun 30, 2026

Copy link
Copy Markdown
Member

Pull Request Description

This PR adds a new modern notification sound set for Android, giving users the ability to choose between modern and classic notification sounds.

Key Changes

New Sound Assets

  • Bundles 20 new modern audio files (e.g., modernnotification.wav, moderncallemergency.wav, moderncallhigh.wav, etc.) covering all standard notification categories — calls, messages, staffing, shifts, weather alerts, and more.

Settings Toggle (Android-only)

  • Adds a new "Modern Notification Sounds" toggle in the Settings screen, allowing users to switch between the modern sound set and the original/classic sounds. The setting is enabled by default.

Notification Channel Logic

  • Maps 7 standard Android notification channels (generic call, emergency/high/medium/low calls, notification, message) to both a modern and a classic sound variant.
  • Since Android channel sounds are immutable once created, the channels are deleted and recreated when the user toggles between modern and classic modes. A tracked "applied sound mode" ensures channels are only recreated when the setting actually changes.
  • Custom call tone channels (c1–c25) are intentionally left unaffected by this setting.

Testing

  • Added unit tests for the new settings component (rendering, platform visibility, toggle behavior).
  • Added integration tests for the push notification service verifying correct sound selection per mode, channel deletion/recreation on mode change, and that custom channels remain untouched.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ucswift, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 759cb4be-3373-42c8-b062-75f10dba9d0f

📥 Commits

Reviewing files that changed from the base of the PR and between 0a94c8f and 846eb4f.

⛔ Files ignored due to path filters (20)
  • assets/audio/modernavailabilityalert.wav is excluded by !**/*.wav
  • assets/audio/moderncalendar.wav is excluded by !**/*.wav
  • assets/audio/moderncallclosed.wav is excluded by !**/*.wav
  • assets/audio/moderncallemergency.wav is excluded by !**/*.wav
  • assets/audio/moderncallhigh.wav is excluded by !**/*.wav
  • assets/audio/moderncalllow.wav is excluded by !**/*.wav
  • assets/audio/moderncallmedium.wav is excluded by !**/*.wav
  • assets/audio/moderncallupdated.wav is excluded by !**/*.wav
  • assets/audio/modernchat.wav is excluded by !**/*.wav
  • assets/audio/modernmessage.wav is excluded by !**/*.wav
  • assets/audio/modernnotification.wav is excluded by !**/*.wav
  • assets/audio/modernpersonnelstatus.wav is excluded by !**/*.wav
  • assets/audio/modernresourceorder.wav is excluded by !**/*.wav
  • assets/audio/modernshift.wav is excluded by !**/*.wav
  • assets/audio/modernstaffing.wav is excluded by !**/*.wav
  • assets/audio/moderntraining.wav is excluded by !**/*.wav
  • assets/audio/moderntroublealert.wav is excluded by !**/*.wav
  • assets/audio/modernunitnotice.wav is excluded by !**/*.wav
  • assets/audio/modernunitstatus.wav is excluded by !**/*.wav
  • assets/audio/modernweatheralert.wav is excluded by !**/*.wav
📒 Files selected for processing (18)
  • .gitignore
  • plugins/withNotificationSounds.js
  • src/app/(app)/settings.tsx
  • src/components/settings/__tests__/modern-notification-sounds-item.test.tsx
  • src/components/settings/modern-notification-sounds-item.tsx
  • src/lib/hooks/use-modern-notification-sounds.ts
  • src/lib/storage/notification-prefs.ts
  • src/services/__tests__/push-notification.test.ts
  • src/services/push-notification.ts
  • src/translations/ar.json
  • src/translations/de.json
  • src/translations/en.json
  • src/translations/es.json
  • src/translations/fr.json
  • src/translations/it.json
  • src/translations/pl.json
  • src/translations/sv.json
  • src/translations/uk.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Resgrid-Bot

Resgrid-Bot commented Jun 30, 2026

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

Comment on lines +20 to +28
const setModernSoundsEnabled = React.useCallback(
async (value: boolean) => {
_setEnabled(value);
if (Platform.OS === 'android') {
await pushNotificationService.refreshAndroidNotificationChannels();
}
},
[_setEnabled]
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

Unhandled promise rejection from pushNotificationService.refreshAndroidNotificationChannels() at line 24 risks leaving the app in an inconsistent state if _setEnabled(value) at line 22 already updated the MMKV preference. Wrap the awaited operations in a try/catch block with structured error logging to match the patterns used in sibling hooks like useKeepAlive and useBackgroundGeolocation.

Kody rule violation: Handle async operations with proper error handling

const setModernSoundsEnabled = React.useCallback(
  async (value: boolean) => {
    try {
      _setEnabled(value);
      if (Platform.OS === 'android') {
        await pushNotificationService.refreshAndroidNotificationChannels();
      }
    } catch (error) {
      logger.error({
        message: 'Failed to update modern notification sounds',
        context: { error, value },
      });
    }
  },
  [_setEnabled]
);
Prompt for LLM

File src/lib/hooks/use-modern-notification-sounds.ts:

Line 20 to 28:

Violates rule 'Handle async operations with proper error handling': the `await pushNotificationService.refreshAndroidNotificationChannels()` at line 24 is not wrapped in try/catch or .catch, leaving a potential unhandled promise rejection. The team's sibling hooks (useKeepAlive and useBackgroundGeolocation) both guard their awaited operations in try/catch with structured error logging. If refreshAndroidNotificationChannels rejects, the MMKV preference has already been flipped (_setEnabled(value) at line 22) but the Android channels will not be updated, leaving the app in an inconsistent state with no error surfaced.

Suggested Code:

  const setModernSoundsEnabled = React.useCallback(
    async (value: boolean) => {
      try {
        _setEnabled(value);
        if (Platform.OS === 'android') {
          await pushNotificationService.refreshAndroidNotificationChannels();
        }
      } catch (error) {
        logger.error({
          message: 'Failed to update modern notification sounds',
          context: { error, value },
        });
      }
    },
    [_setEnabled]
  );

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

@ucswift

ucswift commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

Approve

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit 8496b32 into master Jun 30, 2026
19 of 20 checks passed
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.

2 participants