Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ Create `src/theme.ts` with `AppColors`, `AppSpacing`, and `AppTheme` objects. Ex
### iOS
- Standard React Native setup with push notification entitlement

### Custom Notification Sound

Copy `vine_boom.wav` from [sdk-shared/assets](https://github.com/OneSignal/sdk-shared/tree/main/assets) and place in:

- **Android**: `android/app/src/main/res/raw/vine_boom.wav`
- **iOS**: `ios/demo/vine_boom.wav` (add to Xcode project as a bundle resource)

---

## Key Files Structure
Expand Down
Binary file not shown.
Binary file added examples/demo/assets/vine_boom.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/demo/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/demo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ PODS:
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- ReactNativeDependencies
- react-native-onesignal (5.3.6):
- react-native-onesignal (5.4.0):
- hermes-engine
- OneSignalXCFramework (= 5.5.0)
- RCTRequired
Expand Down Expand Up @@ -2349,7 +2349,7 @@ SPEC CHECKSUMS:
React-logger: 9e51e01455f15cb3ef87a09a1ec773cdb22d56c1
React-Mapbuffer: 92b99e450e8ff598b27d6e4db3a75e04fd45e9a9
React-microtasksnativemodule: 2fe0f2bd2840dedbd66c0ac249c64f977f39cc18
react-native-onesignal: eb0b07478feb04abfc7a2504d34fec0df6317140
react-native-onesignal: 95e69fd48dbdd28700ee6ebe6a5548c107127bf3
react-native-safe-area-context: 37e680fc4cace3c0030ee46e8987d24f5d3bdab2
React-NativeModulesApple: 44a9474594566cd03659f92e38f42599c6b9dee4
React-networking: db73d91466cb134fcbdaaa579fb2de14e2c2ea01
Expand Down
4 changes: 4 additions & 0 deletions examples/demo/ios/demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
A10000000000000000000007 /* libPods-OneSignalWidgetExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A20000000000000000000010 /* libPods-OneSignalWidgetExtension.a */; };
A10000000000000000000008 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A20000000000000000000009 /* WidgetKit.framework */; };
A10000000000000000000009 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2000000000000000000000A /* SwiftUI.framework */; };
B10000000000000000000001 /* vine_boom.wav in Resources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000001 /* vine_boom.wav */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -82,6 +83,7 @@
A2000000000000000000000F /* libPods-OneSignalNotificationServiceExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalNotificationServiceExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A20000000000000000000010 /* libPods-OneSignalWidgetExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalWidgetExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A20000000000000000000011 /* demo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = demo.entitlements; path = demo/demo.entitlements; sourceTree = "<group>"; };
B20000000000000000000001 /* vine_boom.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = vine_boom.wav; path = demo/vine_boom.wav; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -124,6 +126,7 @@
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
A20000000000000000000011 /* demo.entitlements */,
B20000000000000000000001 /* vine_boom.wav */,
);
name = demo;
sourceTree = "<group>";
Expand Down Expand Up @@ -317,6 +320,7 @@
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
5F8F7D5C84F8947D278D5B06 /* PrivacyInfo.xcprivacy in Resources */,
B10000000000000000000001 /* vine_boom.wav in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file added examples/demo/ios/demo/vine_boom.wav
Binary file not shown.
5 changes: 5 additions & 0 deletions examples/demo/src/components/sections/SendPushSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export default function SendPushSection({
onPress={() => onSendNotification(NotificationType.WithImage)}
testID="send_image_push_button"
/>
<ActionButton
label="WITH SOUND"
onPress={() => onSendNotification(NotificationType.WithSound)}
testID="send_sound_push_button"
/>
<ActionButton
label="CUSTOM"
onPress={() => setCustomVisible(true)}
Expand Down
1 change: 1 addition & 0 deletions examples/demo/src/models/NotificationType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum NotificationType {
Simple = 'Simple',
WithImage = 'With Image',
WithSound = 'With Sound',
Custom = 'Custom',
}
6 changes: 6 additions & 0 deletions examples/demo/src/services/OneSignalApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class OneSignalApiService {
'https://media.onesignal.com/automated_push_templates/ratings_template.png',
};
break;
case NotificationType.WithSound:
headings = { en: 'Sound Notification' };
contents = { en: 'This notification plays a custom sound' };
extra.ios_sound = 'vine_boom.wav';
extra.android_channel_id = 'b3b015d9-c050-4042-8548-dcc34aa44aa4';
break;
default:
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion examples/setup.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set -euo pipefail

ORIGINAL_DIR=$(pwd)

# Build root package
cd ../../
bun run build

rm -f react-native-onesignal.tgz
rm -f react-native-onesignal*.tgz
bun pm pack
mv react-native-onesignal-*.tgz react-native-onesignal.tgz

Expand Down
Loading