diff --git a/.gitignore b/.gitignore index 5e75d520..f7d1acbe 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,4 @@ web-build/ .npmrc .yarn/cache -.yarn/install-state.gz - - -google-services.json \ No newline at end of file +.yarn/install-state.gz \ No newline at end of file diff --git a/App.tsx b/App.tsx index 5051b6a7..90345d33 100644 --- a/App.tsx +++ b/App.tsx @@ -21,6 +21,8 @@ type RootStackParamList = { Home: {someParam?: string}; Details: {someParam?: string}; }; +import * as TaskManager from 'expo-task-manager'; +import * as Notifications from 'expo-notifications'; import {retrieveData} from './app/functions'; // import SplashScreen from 'react-native-splash-screen'; @@ -359,7 +361,7 @@ function ResetStack(): JSX.Element | null { return () => { Linking.removeAllListeners('url'); }; - }, [handleDeepLink, getInitialURL]); + }, []); const handleAnimationFinish = () => { setIsLoaded(true); @@ -683,6 +685,19 @@ function ResetStack(): JSX.Element | null { ); } +const BACKGROUND_NOTIFICATION_TASK = 'BACKGROUND-NOTIFICATION-TASK'; + +TaskManager.defineTask( + BACKGROUND_NOTIFICATION_TASK, + ({data, error, executionInfo}) => { + console.log('Received a notification in the background!'); + console.log(data); + // Do something with the notification data + }, +); + +Notifications.registerTaskAsync(BACKGROUND_NOTIFICATION_TASK); + // TaskManager.defineTask( // BACKGROUND_NOTIFICATION_TASK, // ({data, error, executionInfo}) => { diff --git a/android/app/build.gradle b/android/app/build.gradle index 119b78a9..73ff5680 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -124,7 +124,7 @@ dependencies { implementation jscFlavor } - // react-native-notifications - implementation project(':react-native-notifications') + // // react-native-notifications + // implementation project(':react-native-notifications') implementation 'com.google.firebase:firebase-messaging:23.0.0' } \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 00000000..862f71a4 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,30 @@ +{ + "project_info": { + "project_number": "492441809848", + "firebase_url": "https://blitz-wallet-default-rtdb.firebaseio.com", + "project_id": "blitz-wallet", + "storage_bucket": "blitz-wallet.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:492441809848:android:ccd2552c3dfdb1fb9e554d", + "android_client_info": { + "package_name": "com.blitzwallet" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyD0whuYV7aYgj50pjFoiJyT6nwGsIIkdu4" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/java/com/blitzwallet/MainApplication.kt b/android/app/src/main/java/com/blitzwallet/MainApplication.kt index 758383d1..db5164e9 100644 --- a/android/app/src/main/java/com/blitzwallet/MainApplication.kt +++ b/android/app/src/main/java/com/blitzwallet/MainApplication.kt @@ -2,7 +2,6 @@ package com.blitzwallet import android.content.res.Configuration import expo.modules.ApplicationLifecycleDispatcher import expo.modules.ReactNativeHostWrapper -import com.wix.reactnativenotifications.RNNotificationsPackage import android.app.Application import com.facebook.react.PackageList diff --git a/app.json b/app.json index f0433f2f..2ed98311 100644 --- a/app.json +++ b/app.json @@ -11,7 +11,7 @@ } }, "android": { - "googleServicesFile": "./google-services.json" + "googleServicesFile": "./android/app/google-services.json" }, "owner": "bkaufman20" } diff --git a/app/functions/messaging/publishMessage.js b/app/functions/messaging/publishMessage.js index 42451eed..60181e30 100644 --- a/app/functions/messaging/publishMessage.js +++ b/app/functions/messaging/publishMessage.js @@ -122,6 +122,14 @@ async function sendPushNotification({ )} sats`; } + console.log( + JSON.stringify({ + devicePushKey: devicePushKey, + deviceType: deviceType, + message: message, + token: JWT, + }), + ); const response = await fetch( `https://blitz-wallet.com/.netlify/functions/contactsPushNotification`, { diff --git a/ios/BlitzWallet/Info.plist b/ios/BlitzWallet/Info.plist index a8d9c037..0be3c4d0 100644 --- a/ios/BlitzWallet/Info.plist +++ b/ios/BlitzWallet/Info.plist @@ -62,6 +62,22 @@ CFBundleVersion $(CURRENT_PROJECT_VERSION) + LSApplicationQueriesSchemes + + mailto + message + readdle-spark + airmail + ms-outlook + googlegmail + inbox-gmail + ymail + superhuman + yandexmail + fastmail + protonmail + szn-email + LSRequiresIPhoneOS NSAppTransportSecurity @@ -142,26 +158,11 @@ Poppins-Thin.ttf Poppins-ThinItalic.ttf - LSApplicationQueriesSchemes - - mailto - message - readdle-spark - airmail - ms-outlook - googlegmail - inbox-gmail - ymail - superhuman - yandexmail - fastmail - protonmail - szn-email - UIBackgroundModes - remote-notification fetch + processing + remote-notification UILaunchStoryboardName diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 57c1c96b..158984ee 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -80,6 +80,9 @@ PODS: - ExpoWebBrowser (13.0.3): - ExpoModulesCore - EXStructuredHeaders (3.8.0) + - EXTaskManager (11.8.2): + - ExpoModulesCore + - UMAppLoader - EXUpdates (0.25.26): - DoubleConversion - EASClient @@ -1892,6 +1895,7 @@ PODS: - "sqlite3 (3.45.3+1)": - "sqlite3/common (= 3.45.3+1)" - "sqlite3/common (3.45.3+1)" + - UMAppLoader (4.6.0) - VisionCamera (4.5.3): - VisionCamera/Core (= 4.5.3) - VisionCamera/React (= 4.5.3) @@ -1933,6 +1937,7 @@ DEPENDENCIES: - ExpoSpeech (from `../node_modules/expo-speech/ios`) - ExpoWebBrowser (from `../node_modules/expo-web-browser/ios`) - EXStructuredHeaders (from `../node_modules/expo-structured-headers/ios`) + - EXTaskManager (from `../node_modules/expo-task-manager/ios`) - EXUpdates (from `../node_modules/expo-updates/ios`) - EXUpdatesInterface (from `../node_modules/expo-updates-interface/ios`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) @@ -2014,6 +2019,7 @@ DEPENDENCIES: - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) - RNSVG (from `../node_modules/react-native-svg`) + - UMAppLoader (from `../node_modules/unimodules-app-loader/ios`) - VisionCamera (from `../node_modules/react-native-vision-camera`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) @@ -2085,6 +2091,8 @@ EXTERNAL SOURCES: :path: "../node_modules/expo-web-browser/ios" EXStructuredHeaders: :path: "../node_modules/expo-structured-headers/ios" + EXTaskManager: + :path: "../node_modules/expo-task-manager/ios" EXUpdates: :path: "../node_modules/expo-updates/ios" EXUpdatesInterface: @@ -2244,6 +2252,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-screens" RNSVG: :path: "../node_modules/react-native-svg" + UMAppLoader: + :path: "../node_modules/unimodules-app-loader/ios" VisionCamera: :path: "../node_modules/react-native-vision-camera" Yoga: @@ -2279,6 +2289,7 @@ SPEC CHECKSUMS: ExpoSpeech: 258ea713923eb70ef63d3bdb14f47a462d0b6f0e ExpoWebBrowser: 7595ccac6938eb65b076385fd23d035db9ecdc8e EXStructuredHeaders: cb8d1f698e144f4c5547b4c4963e1552f5d2b457 + EXTaskManager: 9c3520305c3aa1b4a12a7c6d1e3f85f2779c06e9 EXUpdates: 61e1a3414212263761b16731611cc174e3eda376 EXUpdatesInterface: 996527fd7d1a5d271eb523258d603f8f92038f24 FBLazyVector: 38bb611218305c3bc61803e287b8a81c6f63b619 @@ -2365,6 +2376,7 @@ SPEC CHECKSUMS: RNSVG: 4590aa95758149fa27c5c83e54a6a466349a1688 SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d sqlite3: 02d1f07eaaa01f80a1c16b4b31dfcbb3345ee01a + UMAppLoader: f17a5ee8e85b536ace0fc254b447a37ed198d57e VisionCamera: cb84d0d8485b3e67c91b62931d3aa88f49747c92 Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5 diff --git a/package.json b/package.json index 35c195d9..0a8c60ae 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "expo-secure-store": "~13.0.2", "expo-speech": "~12.0.2", "expo-status-bar": "~1.12.1", + "expo-task-manager": "~11.8.2", "expo-updates": "~0.25.26", "expo-web-browser": "~13.0.3", "firebase": "^10.14.0", diff --git a/yarn.lock b/yarn.lock index 0e247d92..ba096d93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4979,6 +4979,7 @@ __metadata: expo-secure-store: ~13.0.2 expo-speech: ~12.0.2 expo-status-bar: ~1.12.1 + expo-task-manager: ~11.8.2 expo-updates: ~0.25.26 expo-web-browser: ~13.0.3 firebase: ^10.14.0 @@ -8269,6 +8270,17 @@ __metadata: languageName: node linkType: hard +"expo-task-manager@npm:~11.8.2": + version: 11.8.2 + resolution: "expo-task-manager@npm:11.8.2" + dependencies: + unimodules-app-loader: ~4.6.0 + peerDependencies: + expo: "*" + checksum: ebc0ebb23ce357cfe8be1c19bf781551ea71b40aac69b85814558cf9233b36596241c7b905512bcc174f148aa7d66cd67d2c755747ee16d1359264fc6376ac81 + languageName: node + linkType: hard + "expo-updates-interface@npm:~0.16.2": version: 0.16.2 resolution: "expo-updates-interface@npm:0.16.2" @@ -15115,6 +15127,13 @@ __metadata: languageName: node linkType: hard +"unimodules-app-loader@npm:~4.6.0": + version: 4.6.0 + resolution: "unimodules-app-loader@npm:4.6.0" + checksum: 20897153b02f5436d51090ae30863950abec6a0438e460f4e5561bd155273c2a6eea626d1135fc8b07f5a57c1969e24f89b4ae4d5df198266ee88719db10444d + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0"