Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
568d807
chore(demo): add clean scripts for Android and iOS
fadi-george Mar 18, 2026
a0693f6
feat: add React Native New Architecture support
fadi-george Mar 12, 2026
5f24e32
refactor(ios): standardize RCT method s ignatures
fadi-george Mar 12, 2026
9848169
refactor: standardize object types to Object
fadi-george Mar 12, 2026
409be4a
refactor: migrate from NativeEventEmitter to TurboModule events
fadi-george Mar 12, 2026
6780cf7
feat(ios): add TurboModule support for new arch
fadi-george Mar 12, 2026
f546f11
refactor(ios): remove legacy arch support code
fadi-george Mar 12, 2026
87cb1f6
refactor: use direct native methods over JS wrappers
fadi-george Mar 12, 2026
5c56fdc
refactor: use direct native methods and fix event cleanup
fadi-george Mar 12, 2026
b4f5924
refactor: remove runtime type validation for tags/triggers
fadi-george Mar 12, 2026
1c949a0
test: replace NativeModules with direct mock imports
fadi-george Mar 12, 2026
a1ac922
refactor: remove deprecated sync methods
fadi-george Mar 12, 2026
21a92dd
docs: add v5 to v6 migration guide
fadi-george Mar 12, 2026
ae3d4a0
style: format code and remove unused imports
fadi-george Mar 12, 2026
830981f
refactor(demo): add AppInputProps to TextInputs
fadi-george Mar 12, 2026
60d800e
refactor: update TurboModule types from object to Object
fadi-george Mar 13, 2026
fddafdb
refactor: rename RCTOneSignal.m to .mm for new arch
fadi-george Mar 13, 2026
fa1bf98
refactor: import OneSignalUser Swift module
fadi-george Mar 13, 2026
776822d
refactor(ios): remove legacy Xcode project and update imports
fadi-george Mar 13, 2026
42031e9
refactor(android): update SDK versions and dependencies
fadi-george Mar 13, 2026
ea1d567
more clean up
fadi-george Mar 13, 2026
6358fb7
feat: restore deprecated sync methods for backwards compatibility
fadi-george Mar 18, 2026
74f7297
chore: update OneSignalXCFramework to 5.5.0
fadi-george Mar 18, 2026
4660c46
build(ios): bump minimum platform to iOS 15.1
fadi-george Mar 18, 2026
cf81d92
chore(demo): simplify Android and iOS clean scripts
fadi-george Mar 18, 2026
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
55 changes: 15 additions & 40 deletions __mocks__/react-native.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
import { vi } from 'vitest';

export const createEmitterSubscriptionMock = (
eventName: string,
callback: (payload: unknown) => void,
) => ({
remove: vi.fn(),
emitter: {
addListener: vi.fn(),
removeAllListeners: vi.fn(),
listenerCount: vi.fn(() => 1),
emit: vi.fn(),
},
listener: () => callback,
context: undefined,
eventType: eventName,
key: 0,
subscriber: {
addSubscription: vi.fn(),
removeSubscription: vi.fn(),
removeAllSubscriptions: vi.fn(),
getSubscriptionsForType: vi.fn(),
},
});
const createEventEmitterMock = () => vi.fn(() => ({ remove: vi.fn() }));

const mockRNOneSignal = {
initialize: vi.fn(),
Expand Down Expand Up @@ -56,6 +35,7 @@ const mockRNOneSignal = {
addSms: vi.fn(),
removeSms: vi.fn(),
addTag: vi.fn(),
removeTag: vi.fn(),
addTags: vi.fn(),
removeTags: vi.fn(),
getTags: vi.fn(),
Expand All @@ -72,6 +52,7 @@ const mockRNOneSignal = {
removeGroupedNotifications: vi.fn(),
addInAppMessageClickListener: vi.fn(),
addInAppMessagesLifecycleListener: vi.fn(),
addTrigger: vi.fn(),
addTriggers: vi.fn(),
removeTrigger: vi.fn(),
removeTriggers: vi.fn(),
Expand All @@ -87,32 +68,26 @@ const mockRNOneSignal = {
displayNotification: vi.fn(),
preventDefault: vi.fn(),
trackEvent: vi.fn(),
onPermissionChanged: createEventEmitterMock(),
onSubscriptionChanged: createEventEmitterMock(),
onUserStateChanged: createEventEmitterMock(),
onNotificationWillDisplay: createEventEmitterMock(),
onNotificationClicked: createEventEmitterMock(),
onInAppMessageClicked: createEventEmitterMock(),
onInAppMessageWillDisplay: createEventEmitterMock(),
onInAppMessageDidDisplay: createEventEmitterMock(),
onInAppMessageWillDismiss: createEventEmitterMock(),
onInAppMessageDidDismiss: createEventEmitterMock(),
};

const mockPlatform = {
OS: 'ios',
};

export const NativeModules = {
OneSignal: mockRNOneSignal,
export const TurboModuleRegistry = {
getEnforcing: (_name: string) => mockRNOneSignal,
};

export const Platform = mockPlatform;

export { mockPlatform, mockRNOneSignal };

export class NativeEventEmitter {
constructor(_nativeModule: typeof mockRNOneSignal) {}

addListener(eventName: string, callback: (payload: unknown) => void) {
return createEmitterSubscriptionMock(eventName, callback);
}

removeListener(_eventName: string, _callback: (payload: unknown) => void) {
// Mock implementation
}

removeAllListeners(_eventName: string) {
// Mock implementation
}
}
13 changes: 5 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apply plugin: 'com.android.library'
apply plugin: 'com.facebook.react'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
namespace "com.onesignal.rnonesignalandroid"
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
compileSdkVersion safeExtGet('compileSdkVersion', 34)

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
minSdkVersion safeExtGet('minSdkVersion', 21)
}
buildTypes {
release {
Expand All @@ -19,16 +19,13 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"

// 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
Expand Down
19 changes: 2 additions & 17 deletions android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.4.1_1/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# OneSignal SDK ships its own consumer proguard rules.
# Add project-specific rules here if needed.
Loading
Loading