Skip to content

feat: add ClearAllNotifications and simplify demo build guide#162

Merged
fadi-george merged 9 commits intomainfrom
fg/clear-notifications
Mar 10, 2026
Merged

feat: add ClearAllNotifications and simplify demo build guide#162
fadi-george merged 9 commits intomainfrom
fg/clear-notifications

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Mar 9, 2026

Description

One Line Summary

Addresses: #133

Add ClearAllNotifications to the SDK interface and wire it up in the demo app, plus simplify the demo build guide to reference the shared sdk-shared docs.

Details

Motivation

The demo app was missing a way to clear all delivered notifications. Other wrapper SDKs already expose this. The build guide was also duplicating content that now lives in the shared sdk-shared/demo/build.md, so it was trimmed to only contain .NET MAUI-specific details.

Scope

SDK interface gains ClearAllNotifications() on INotificationsManager, implemented on both Android and iOS. The demo app gets a new "CLEAR ALL" button in the Send Push Notification section. The build guide is restructured to reference the shared guide and only list DotNet-specific overrides.

Changes

SDK (public API)

  • INotificationsManager gains void ClearAllNotifications()
  • Android: delegates to OneSignalNative.Notifications.ClearAllNotifications()
  • iOS: delegates to OneSignalNative.Notifications.ClearAll()

Demo app

  • OneSignalRepository.ClearAllNotifications() wraps the SDK call
  • AppViewModel.ClearAllNotifications() command with log message
  • SendPushSection.xaml adds a CLEAR ALL button (AutomationId="clear_all_notifications_button")
  • SendPushSection.xaml.cs wires the click handler

Build guide

  • examples/build.md now references the shared sdk-shared/demo/build.md and only contains .NET MAUI-specific overrides (reduced from ~1095 to ~339 lines)

Testing

Manual testing

Built and ran the demo app on Android emulator. Verified the CLEAR ALL button calls through to the SDK and clears delivered notifications from the tray.

Android

Screenshot 2026-03-09 at 4 51 35 PM Screenshot 2026-03-09 at 4 58 21 PM

iOS

Screenshot 2026-03-09 at 4 55 00 PM Screenshot 2026-03-09 at 4 55 08 PM

Affected code checklist

  • Notifications
    • Display
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

Replaces comprehensive build instructions with a concise guide that extends the shared build documentation from sdk-shared repo, reducing duplication and maintenance overhead.
@fadi-george fadi-george requested a review from nan-li March 10, 2026 00:01
Copy link
Copy Markdown

@nan-li nan-li left a comment

Choose a reason for hiding this comment

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

Public API should be OneSignal.Notifications.clearAll() to match API on all other platforms

@fadi-george
Copy link
Copy Markdown
Contributor Author

fadi-george commented Mar 10, 2026

Public API should be OneSignal.Notifications.clearAll() to match API on all other platforms

Done, for C# were using pascal case

@fadi-george fadi-george requested a review from nan-li March 10, 2026 01:15
@fadi-george fadi-george force-pushed the fg/clear-notifications branch from 11ca5aa to 14258c8 Compare March 10, 2026 02:46
@fadi-george fadi-george force-pushed the fg/clear-notifications branch from 14258c8 to 9982556 Compare March 10, 2026 02:49
@fadi-george fadi-george changed the title feat: add ClearAllNotifications and simplify demo build guide feat: add ClearAll and simplify demo build guide Mar 10, 2026
@fadi-george fadi-george changed the title feat: add ClearAll and simplify demo build guide feat: add ClearAllNotifications and simplify demo build guide Mar 10, 2026
@fadi-george fadi-george merged commit 9f6fc43 into main Mar 10, 2026
7 checks passed
@fadi-george fadi-george deleted the fg/clear-notifications branch March 10, 2026 17:50
This was referenced Mar 10, 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.

3 participants