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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {

// api is used instead of implementation so the parent :app project can access any of the OneSignal Java
// classes if needed. Such as com.onesignal.NotificationExtenderService
api 'com.onesignal:OneSignal:5.1.38'
api 'com.onesignal:OneSignal:5.4.2'

testImplementation 'junit:junit:4.12'
}
75 changes: 43 additions & 32 deletions examples/RNOneSignalTS/OSDemo.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { useFocusEffect } from '@react-navigation/native';
import React, { useCallback, useEffect, useState } from 'react';
import {
Alert,
ScrollView,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
import { LogLevel, OneSignal } from 'react-native-onesignal';
import {
LogLevel,
NotificationClickEvent,
NotificationWillDisplayEvent,
OneSignal,
} from 'react-native-onesignal';
import { SafeAreaView } from 'react-native-safe-area-context';
import OSButtons from './OSButtons';
import OSConsole from './OSConsole';
Expand Down Expand Up @@ -37,44 +41,51 @@ const OSDemo: React.FC = () => {
}, []);

const onForegroundWillDisplay = useCallback(
(event: unknown) => {
OSLog('OneSignal: notification will show in foreground:', event);
const notif = (
event as { getNotification: () => { title: string } }
).getNotification();
(event: NotificationWillDisplayEvent) => {
const notif = event.getNotification();
OSLog('OneSignal: notification will show in foreground:', notif.title);
console.log('Will display notification event:', notif);

const cancelButton = {
text: 'Cancel',
onPress: () => {
(event as { preventDefault: () => void }).preventDefault();
},
style: 'cancel' as const,
};
event.preventDefault();

const completeButton = {
text: 'Display',
onPress: () => {
(event as { getNotification: () => { display: () => void } })
.getNotification()
.display();
},
};
setTimeout(() => {
notif.display();
}, 5000);

Alert.alert(
'Display notification?',
notif.title,
[cancelButton, completeButton],
{
cancelable: true,
},
);
// const cancelButton = {
// text: 'Cancel',
// onPress: () => {
// (event as { preventDefault: () => void }).preventDefault();
// },
// style: 'cancel' as const,
// };

// const completeButton = {
// text: 'Display',
// onPress: () => {
// (event as { getNotification: () => { display: () => void } })
// .getNotification()
// .display();
// },
// };

// Alert.alert(
// 'Display notification?',
// notif.title,
// [cancelButton, completeButton],
// {
// cancelable: true,
// },
// );
},
[OSLog],
);

const onNotificationClick = useCallback(
(event: unknown) => {
OSLog('OneSignal: notification clicked:', event);
(event: NotificationClickEvent) => {
const notif = event.notification;
OSLog('OneSignal: notification clicked:', notif.title);
console.log('Notification clicked event:', notif);
},
[OSLog],
);
Expand Down
34 changes: 17 additions & 17 deletions examples/RNOneSignalTS/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@ PODS:
- hermes-engine (0.82.1):
- hermes-engine/Pre-built (= 0.82.1)
- hermes-engine/Pre-built (0.82.1)
- OneSignalXCFramework (5.2.15):
- OneSignalXCFramework/OneSignalComplete (= 5.2.15)
- OneSignalXCFramework/OneSignal (5.2.15):
- OneSignalXCFramework (5.2.16):
- OneSignalXCFramework/OneSignalComplete (= 5.2.16)
- OneSignalXCFramework/OneSignal (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalLiveActivities
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalComplete (5.2.15):
- OneSignalXCFramework/OneSignalComplete (5.2.16):
- OneSignalXCFramework/OneSignal
- OneSignalXCFramework/OneSignalInAppMessages
- OneSignalXCFramework/OneSignalLocation
- OneSignalXCFramework/OneSignalCore (5.2.15)
- OneSignalXCFramework/OneSignalExtension (5.2.15):
- OneSignalXCFramework/OneSignalCore (5.2.16)
- OneSignalXCFramework/OneSignalExtension (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalInAppMessages (5.2.15):
- OneSignalXCFramework/OneSignalInAppMessages (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalLiveActivities (5.2.15):
- OneSignalXCFramework/OneSignalLiveActivities (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalLocation (5.2.15):
- OneSignalXCFramework/OneSignalLocation (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalNotifications (5.2.15):
- OneSignalXCFramework/OneSignalNotifications (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalOSCore (5.2.15):
- OneSignalXCFramework/OneSignalOSCore (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes (5.2.15):
- OneSignalXCFramework/OneSignalOutcomes (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalUser (5.2.15):
- OneSignalXCFramework/OneSignalUser (5.2.16):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
Expand Down Expand Up @@ -1828,8 +1828,8 @@ PODS:
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- SocketRocket
- react-native-onesignal (5.2.16):
- OneSignalXCFramework (= 5.2.15)
- react-native-onesignal (5.2.17):
- OneSignalXCFramework (= 5.2.16)
- React (< 1.0.0, >= 0.13.0)
- react-native-safe-area-context (5.6.2):
- boost
Expand Down Expand Up @@ -2768,7 +2768,7 @@ SPEC CHECKSUMS:
fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd
glog: 5683914934d5b6e4240e497e0f4a3b42d1854183
hermes-engine: 273e30e7fb618279934b0b95ffab60ecedb7acf5
OneSignalXCFramework: ea9e14a95b92ad48d9b35037cbae88a9542bdea3
OneSignalXCFramework: 8ed6648481bee0bd973a138fecd80331b798524f
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
RCTDeprecation: f17e2ebc07876ca9ab8eb6e4b0a4e4647497ae3a
RCTRequired: e2c574c1b45231f7efb0834936bd609d75072b63
Expand Down Expand Up @@ -2802,7 +2802,7 @@ SPEC CHECKSUMS:
React-logger: 500f2fa5697d224e63c33d913c8a4765319e19bf
React-Mapbuffer: 06d59c448da7e34eb05b3fb2189e12f6a30fec57
React-microtasksnativemodule: d1ee999dc9052e23f6488b730fa2d383a4ea40e5
react-native-onesignal: 1634e96223d6a666b76f38f4a20fec6c87bbb0c4
react-native-onesignal: 3b6cd199ec0db87166ef7fb595715627a35b3244
react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460
React-NativeModulesApple: 46690a0fe94ec28fc6fc686ec797b911d251ded0
React-oscompat: 95875e81f5d4b3c7b2c888d5bd2c9d83450d8bdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"\\\"$WITH_ENVIRONMENT\\\" \\\"$REACT_NATIVE_XCODE\\\"\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
2 changes: 1 addition & 1 deletion examples/RNOneSignalTS/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ bun pm pack
mv react-native-onesignal-*.tgz react-native-onesignal.tgz

# Use fresh install of the package
cd $ORIGINAL_DIR
cd "$ORIGINAL_DIR"
bun pm cache rm
bun i
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-onesignal",
"version": "5.2.16",
"version": "5.2.17",
"description": "React Native OneSignal SDK",
"files": [
"dist",
Expand Down
2 changes: 1 addition & 1 deletion react-native-onesignal.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Pod::Spec.new do |s|
# pod 'React', :path => '../node_modules/react-native/'

# The Native OneSignal-iOS-SDK XCFramework from cocoapods.
s.dependency 'OneSignalXCFramework', '5.2.15'
s.dependency 'OneSignalXCFramework', '5.2.16'
end