From 99ae88efd2f47096e60ad6a2a657fe60138ca4fb Mon Sep 17 00:00:00 2001 From: Matiluko Opeyemi Emmanuel Date: Thu, 1 Feb 2024 19:07:37 +0100 Subject: [PATCH 1/5] Update tsconfig.json add "jsx": "react", --- examples/RNOneSignalExpoExample/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/RNOneSignalExpoExample/tsconfig.json b/examples/RNOneSignalExpoExample/tsconfig.json index b9567f6..7886cc1 100644 --- a/examples/RNOneSignalExpoExample/tsconfig.json +++ b/examples/RNOneSignalExpoExample/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "expo/tsconfig.base", "compilerOptions": { + "jsx": "react", "strict": true } } From 8330df4084f44ec28f1d67576a8bc87160c63ce3 Mon Sep 17 00:00:00 2001 From: Matiluko Opeyemi Emmanuel Date: Thu, 1 Feb 2024 19:13:08 +0100 Subject: [PATCH 2/5] Update package.json - Bump version to 1.0.1 - Update dependencies - Bump react and react-dom from version 17.0.2 to 18.2.0 - Bump react-native from version 0.68.2 to 0.72.6 - Bump react-native-onesignal from version 4.4.1 to 5.0.4 - Bump onesignal-expo-plugin from version 1.3.2 to 2.0.2 - Bump expo from version 45.0.0 to 49.0.15 (45.0.0 of deprecated) - and so on --- examples/RNOneSignalExpoExample/package.json | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/RNOneSignalExpoExample/package.json b/examples/RNOneSignalExpoExample/package.json index 8b0082d..1f5e67a 100644 --- a/examples/RNOneSignalExpoExample/package.json +++ b/examples/RNOneSignalExpoExample/package.json @@ -1,6 +1,6 @@ { "name": "my-app", - "version": "1.0.0", + "version": "1.0.1", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", @@ -9,22 +9,21 @@ "eject": "expo eject" }, "dependencies": { - "expo": "~45.0.0", - "expo-constants": "^13.1.1", - "expo-dev-client": "~0.9.5", - "expo-splash-screen": "~0.15.1", - "expo-status-bar": "~1.3.0", - "onesignal-expo-plugin": "^1.3.2", - "react": "17.0.2", - "react-dom": "17.0.2", - "react-native": "0.68.2", - "react-native-onesignal": "^4.4.1", - "react-native-web": "0.17.7" + "expo": "~49.0.15", + "expo-constants": "^14.4.2", + "expo-dev-client": "~2.4.12", + "expo-splash-screen": "~0.26.1", + "expo-status-bar": "~1.11.1", + "onesignal-expo-plugin": "^2.0.2", + "react": "18.2.0", + "react-dom": "18.2.0", + "react-native": "0.72.6", + "react-native-onesignal": "^5.0.4", + "react-native-web": "0.19.6" }, "devDependencies": { - "@babel/core": "^7.12.9", - "@types/react": "~17.0.21", - "@types/react-native": "~0.66.13", + "@babel/core": "^7.20.0", + "@types/react": "~18.2.21", "typescript": "~4.3.5" }, "private": true From b36e280ca5c0b3a1e7bd2bcecb281cc35f708387 Mon Sep 17 00:00:00 2001 From: Matiluko Opeyemi Emmanuel Date: Thu, 1 Feb 2024 19:15:24 +0100 Subject: [PATCH 3/5] Update eas.json - Bump supported eas-cli version from 0.48.2 to minimum 5.6.0 --- examples/RNOneSignalExpoExample/eas.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RNOneSignalExpoExample/eas.json b/examples/RNOneSignalExpoExample/eas.json index 44930a4..9aeb0d5 100644 --- a/examples/RNOneSignalExpoExample/eas.json +++ b/examples/RNOneSignalExpoExample/eas.json @@ -1,6 +1,6 @@ { "cli": { - "version": ">= 0.48.2" + "version": ">= 5.6.0" }, "build": { "development": { From 19eb36eda962167bf9e183fce14314e3c6a1d141 Mon Sep 17 00:00:00 2001 From: Matiluko Opeyemi Emmanuel Date: Thu, 1 Feb 2024 19:15:55 +0100 Subject: [PATCH 4/5] Update app.json - Bump version to 1.0.1 --- examples/RNOneSignalExpoExample/app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/RNOneSignalExpoExample/app.json b/examples/RNOneSignalExpoExample/app.json index 5f0e7b3..a6a6484 100644 --- a/examples/RNOneSignalExpoExample/app.json +++ b/examples/RNOneSignalExpoExample/app.json @@ -2,7 +2,7 @@ "expo": { "name": "my-app", "slug": "my-app", - "version": "1.0.0", + "version": "1.0.1", "orientation": "portrait", "icon": "./assets/icon.png", "userInterfaceStyle": "light", From 5a817764e26b4ba14d813aba54d6b5219981de49 Mon Sep 17 00:00:00 2001 From: Matiluko Opeyemi Emmanuel Date: Thu, 1 Feb 2024 19:17:32 +0100 Subject: [PATCH 5/5] Update App.tsx Update the code to reflect changes in plugin version 2.0.2 --- examples/RNOneSignalExpoExample/App.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/RNOneSignalExpoExample/App.tsx b/examples/RNOneSignalExpoExample/App.tsx index cbc3569..69b03c8 100644 --- a/examples/RNOneSignalExpoExample/App.tsx +++ b/examples/RNOneSignalExpoExample/App.tsx @@ -1,13 +1,21 @@ +import React from 'react'; import { StatusBar } from 'expo-status-bar'; import { StyleSheet, Text, View } from 'react-native'; -import OneSignal from 'react-native-onesignal'; +import { LogLevel, OneSignal } from "react-native-onesignal"; const initOneSignal = () => { - OneSignal.setAppId("8fbf6c72-4b80-47a8-86ae-68de02259355"); - OneSignal.setLogLevel(6, 0); - OneSignal.promptForPushNotificationsWithUserResponse(response => { - console.log(response); - }); + OneSignal.initialize("8fbf6c72-4b80-47a8-86ae-68de02259355"); + OneSignal.Debug.setLogLevel(LogLevel.Verbose); + + // Also need to enable notifications to complete OneSignal setup + if (await OneSignal.Notifications.canRequestPermission()) { + let permission = OneSignal.Notifications.hasPermission(); + if (!permission) { + await OneSignal.Notifications.requestPermission(true); + } + } + OneSignal.setConsentRequired(true); + OneSignal.setConsentGiven(true); } export default function App() {