mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 11:18:24 +00:00
iOS notifications
This commit is contained in:
@@ -39,6 +39,7 @@ local.properties
|
||||
.cxx/
|
||||
*.keystore
|
||||
!debug.keystore
|
||||
.kotlin/
|
||||
|
||||
# node.js
|
||||
#
|
||||
|
||||
@@ -8,3 +8,9 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
||||
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
||||
gem 'xcodeproj', '< 1.26.0'
|
||||
gem 'concurrent-ruby', '< 1.3.4'
|
||||
|
||||
# Ruby 3.4.0 has removed some libraries from the standard library.
|
||||
gem 'bigdecimal'
|
||||
gem 'logger'
|
||||
gem 'benchmark'
|
||||
gem 'mutex_m'
|
||||
@@ -66,14 +66,14 @@ def enableProguardInReleaseBuilds = false
|
||||
* The preferred build flavor of JavaScriptCore (JSC)
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
* `def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
||||
|
||||
/**
|
||||
* Private function to get the list of Native Architectures you want to build.
|
||||
|
||||
@@ -3,7 +3,7 @@ buildscript {
|
||||
buildToolsVersion = "35.0.0"
|
||||
minSdkVersion = 24
|
||||
compileSdkVersion = 35
|
||||
targetSdkVersion = 34
|
||||
targetSdkVersion = 35
|
||||
ndkVersion = "27.1.12297006"
|
||||
kotlinVersion = "2.0.21"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Vendored
+2
-3
@@ -86,8 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -206,7 +205,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
+772
-513
File diff suppressed because it is too large
Load Diff
@@ -318,8 +318,12 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = cash.minibits.wallet;
|
||||
PRODUCT_NAME = minibits_wallet;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -347,7 +351,11 @@
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = cash.minibits.wallet;
|
||||
PRODUCT_NAME = minibits_wallet;
|
||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@@ -5,19 +5,39 @@ import ReactAppDependencyProvider
|
||||
import Firebase
|
||||
|
||||
@main
|
||||
class AppDelegate: RCTAppDelegate {
|
||||
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
var reactNativeDelegate: ReactNativeDelegate?
|
||||
var reactNativeFactory: RCTReactNativeFactory?
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
|
||||
) -> Bool {
|
||||
|
||||
FirebaseApp.configure()
|
||||
self.moduleName = "minibits_wallet"
|
||||
self.dependencyProvider = RCTAppDependencyProvider()
|
||||
|
||||
// You can add your custom initial props in the dictionary below.
|
||||
// They will be passed down to the ViewController used by React Native.
|
||||
self.initialProps = [:]
|
||||
let delegate = ReactNativeDelegate()
|
||||
let factory = RCTReactNativeFactory(delegate: delegate)
|
||||
delegate.dependencyProvider = RCTAppDependencyProvider()
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
reactNativeDelegate = delegate
|
||||
reactNativeFactory = factory
|
||||
|
||||
window = UIWindow(frame: UIScreen.main.bounds)
|
||||
|
||||
factory.startReactNative(
|
||||
withModuleName: "minibits_wallet",
|
||||
in: window,
|
||||
launchOptions: launchOptions
|
||||
)
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
|
||||
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
||||
self.bundleURL()
|
||||
}
|
||||
|
||||
@@ -55,8 +55,12 @@
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
|
||||
+35
-33
@@ -16,7 +16,8 @@
|
||||
"adb": "adb devices && adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081",
|
||||
"adb:unreverse": "adb devices && adb reverse --remove-all",
|
||||
"adb:inspect": "adb shell input keyevent 82",
|
||||
"postinstall": "patch-package --exclude 'nothing'"
|
||||
"postinstall": "patch-package --exclude 'nothing'",
|
||||
"clean": "react-native-clean-project"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cashu/cashu-ts": "minibits-cash/cashu-ts#2b51a7ba7a8461a0040359eecda37b98b603692c",
|
||||
@@ -29,51 +30,51 @@
|
||||
"@gandlaf21/bolt11-decode": "^3.1.1",
|
||||
"@gocodingnow/rn-size-matters": "^0.0.4",
|
||||
"@notifee/react-native": "^9.1.8",
|
||||
"@react-native-clipboard/clipboard": "^1.16.1",
|
||||
"@react-native-clipboard/clipboard": "^1.16.2",
|
||||
"@react-native-community/netinfo": "^11.4.1",
|
||||
"@react-native-firebase/app": "^21.7.1",
|
||||
"@react-native-firebase/messaging": "^21.7.1",
|
||||
"@react-navigation/bottom-tabs": "^7.2.0",
|
||||
"@react-navigation/native": "^7.0.14",
|
||||
"@react-navigation/native-stack": "^7.2.0",
|
||||
"@react-native-firebase/app": "^21.12.3",
|
||||
"@react-native-firebase/messaging": "^21.12.3",
|
||||
"@react-navigation/bottom-tabs": "^7.3.3",
|
||||
"@react-navigation/native": "^7.0.19",
|
||||
"@react-navigation/native-stack": "^7.3.3",
|
||||
"@react-navigation/stack": "^7.1.1",
|
||||
"@scure/bip39": "1.5.0",
|
||||
"@sentry/react-native": "^6.5.0",
|
||||
"@sentry/react-native": "^6.10.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"i18n-js": "^4.5.1",
|
||||
"js-lnurl": "^0.6.0",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"lodash.debounce": "4.0.8",
|
||||
"message-port-polyfill": "^0.2.0",
|
||||
"mobx": "^6.13.5",
|
||||
"mobx": "^6.13.7",
|
||||
"mobx-react-lite": "^4.1.0",
|
||||
"mobx-state-tree": "^7.0.1",
|
||||
"mobx-state-tree": "^7.0.2",
|
||||
"nostr-tools": "minibits-cash/nostr-tools#2991f59d0150a0cb2c71e2f9a4cb6c8aca3b19d7",
|
||||
"numbro": "^2.5.0",
|
||||
"patch-package": "^8.0.0",
|
||||
"react": "18.3.1",
|
||||
"react-native": "0.77.0",
|
||||
"react": "19.0.0",
|
||||
"react-native": "0.79.0-rc.3",
|
||||
"react-native-animated-pagination-dots": "^0.1.73",
|
||||
"react-native-camera-kit": "14.2.0",
|
||||
"react-native-dotenv": "^3.4.11",
|
||||
"react-native-exit-app": "^2.0.0",
|
||||
"react-native-flash-message": "^0.4.2",
|
||||
"react-native-gesture-handler": "^2.22.1",
|
||||
"react-native-json-tree": "^1.4.0",
|
||||
"react-native-keychain": "^9.2.2",
|
||||
"react-native-gesture-handler": "^2.24.0",
|
||||
"react-native-json-tree": "^1.5.0",
|
||||
"react-native-keychain": "^10.0.0",
|
||||
"react-native-logs": "^5.3.0",
|
||||
"react-native-mmkv": "^3.2.0",
|
||||
"react-native-modal": "^13.0.1",
|
||||
"react-native-modal": "^14.0.0-rc.1",
|
||||
"react-native-pager-view": "^6.7.0",
|
||||
"react-native-qrcode-svg": "^6.3.14",
|
||||
"react-native-qrcode-svg": "^6.3.15",
|
||||
"react-native-quick-base64": "^2.1.2",
|
||||
"react-native-quick-crypto": "^0.7.11",
|
||||
"react-native-quick-crypto": "^0.7.12",
|
||||
"react-native-quick-sqlite": "8.2.7",
|
||||
"react-native-reanimated": "^3.16.7",
|
||||
"react-native-safe-area-context": "^5.1.0",
|
||||
"react-native-screens": "^4.6.0",
|
||||
"react-native-svg": "^15.11.1",
|
||||
"react-native-tab-view": "^4.0.5",
|
||||
"react-native-reanimated": "^3.17.1",
|
||||
"react-native-safe-area-context": "^5.3.0",
|
||||
"react-native-screens": "^4.10.0",
|
||||
"react-native-svg": "^15.11.2",
|
||||
"react-native-tab-view": "^4.0.6",
|
||||
"react-native-url-polyfill": "^2.0.0",
|
||||
"taskon": "^0.3.1",
|
||||
"text-encoding-polyfill": "^0.6.7",
|
||||
@@ -84,25 +85,26 @@
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"@babel/runtime": "^7.25.0",
|
||||
"@react-native-community/cli": "15.0.1",
|
||||
"@react-native-community/cli-platform-android": "15.0.1",
|
||||
"@react-native-community/cli-platform-ios": "15.0.1",
|
||||
"@react-native/babel-preset": "0.77.0",
|
||||
"@react-native/eslint-config": "0.77.0",
|
||||
"@react-native/metro-config": "0.77.0",
|
||||
"@react-native/typescript-config": "0.77.0",
|
||||
"@react-native-community/cli": "18.0.0",
|
||||
"@react-native-community/cli-platform-android": "18.0.0",
|
||||
"@react-native-community/cli-platform-ios": "18.0.0",
|
||||
"@react-native/babel-preset": "0.79.0-rc.3",
|
||||
"@react-native/eslint-config": "0.79.0-rc.3",
|
||||
"@react-native/metro-config": "0.79.0-rc.3",
|
||||
"@react-native/typescript-config": "0.79.0-rc.3",
|
||||
"@tsconfig/react-native": "^3.0.0",
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/lodash.clonedeep": "^4.5.9",
|
||||
"@types/react": "^18.2.6",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-test-renderer": "^19.0.0",
|
||||
"babel-plugin-module-resolver": "^5.0.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-unused-imports": "^2.0.0",
|
||||
"jest": "^29.6.3",
|
||||
"metro-react-native-babel-preset": "0.76.7",
|
||||
"prettier": "2.8.8",
|
||||
"react-test-renderer": "18.3.1",
|
||||
"react-native-clean-project": "^4.0.3",
|
||||
"react-test-renderer": "19.0.0",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import React, {FC, useEffect, useRef, useState} from 'react'
|
||||
import {AppState, TextStyle, View, ViewStyle, useColorScheme} from 'react-native'
|
||||
import notifee from '@notifee/react-native'
|
||||
import {AppState, Platform, TextStyle, View, ViewStyle, useColorScheme} from 'react-native'
|
||||
import notifee, { AuthorizationStatus } from '@notifee/react-native'
|
||||
import messaging from '@react-native-firebase/messaging'
|
||||
import {
|
||||
APP_ENV,
|
||||
CODEPUSH_STAGING_DEPLOYMENT_KEY,
|
||||
CODEPUSH_PRODUCTION_DEPLOYMENT_KEY,
|
||||
} from '@env'
|
||||
// import codePush, { RemotePackage } from 'react-native-code-push'
|
||||
import {ThemeCode, Themes, colors, spacing, useThemeColor} from '../theme'
|
||||
import {ListItem, Screen, Text, Card, NwcIcon, Button, BottomModal, InfoModal, Icon} from '../components'
|
||||
import {useHeader} from '../utils/useHeader'
|
||||
@@ -23,8 +20,6 @@ import { SvgXml } from 'react-native-svg'
|
||||
import { CurrencySign } from './Wallet/CurrencySign'
|
||||
import { CommonActions, StaticScreenProps, useNavigation } from '@react-navigation/native'
|
||||
|
||||
const deploymentKey = APP_ENV === Env.PROD ? CODEPUSH_PRODUCTION_DEPLOYMENT_KEY : CODEPUSH_STAGING_DEPLOYMENT_KEY
|
||||
|
||||
type Props = StaticScreenProps<undefined>
|
||||
|
||||
export const SettingsScreen = observer(function SettingsScreen({ route }: Props) {
|
||||
@@ -71,7 +66,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const getNotificationPermission = async () => {
|
||||
const getDeviceToken = async () => {
|
||||
try {
|
||||
const enabled = await NotificationService.areNotificationsEnabled()
|
||||
setAreNotificationsEnabled(enabled)
|
||||
@@ -88,7 +83,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
return false // silent
|
||||
}
|
||||
}
|
||||
getNotificationPermission()
|
||||
getDeviceToken()
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -175,7 +170,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
))
|
||||
}
|
||||
|
||||
const gotoUpdate = function() {
|
||||
/* const gotoUpdate = function() {
|
||||
navigation.navigate('Update', {
|
||||
isNativeUpdateAvailable,
|
||||
isUpdateAvailable,
|
||||
@@ -183,14 +178,28 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
updateSize,
|
||||
prevScreen: 'Settings'
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
const gotoNwc = function() {
|
||||
navigation.navigate('Nwc')
|
||||
}
|
||||
|
||||
const openNotificationSettings = async function() {
|
||||
if(Platform.OS === 'android') {
|
||||
await notifee.openNotificationSettings()
|
||||
} else {
|
||||
const settings = await notifee.requestPermission()
|
||||
if (settings.authorizationStatus >= AuthorizationStatus.AUTHORIZED) {
|
||||
log.trace('iOS Permission settings:', settings)
|
||||
await messaging().registerDeviceForRemoteMessages()
|
||||
const deviceToken = await messaging().getToken()
|
||||
if(deviceToken) {
|
||||
await walletProfileStore.setDevice(deviceToken)
|
||||
}
|
||||
} else {
|
||||
log.trace('iOS user declined permissions')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* const gotoPreferredUnit = function() {
|
||||
@@ -434,7 +443,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
bottomSeparator={true}
|
||||
onPress={gotoPrivacy}
|
||||
/>
|
||||
<ListItem
|
||||
{/*<ListItem
|
||||
tx='settingsScreen.update'
|
||||
leftIcon='faWandMagicSparkles'
|
||||
leftIconColor={(isUpdateAvailable || isNativeUpdateAvailable) ? colors.palette.iconMagenta200 : colors.palette.neutral400}
|
||||
@@ -450,7 +459,7 @@ export const SettingsScreen = observer(function SettingsScreen({ route }: Props)
|
||||
style={$item}
|
||||
bottomSeparator={true}
|
||||
onPress={gotoUpdate}
|
||||
/>
|
||||
/>*/}
|
||||
<ListItem
|
||||
tx='settingsScreen.devOptions'
|
||||
leftIcon='faCode'
|
||||
|
||||
@@ -94,6 +94,10 @@ const initNotifications = async () => {
|
||||
await messaging().registerDeviceForRemoteMessages()
|
||||
const deviceToken = await messaging().getToken()
|
||||
log.trace(`[initNotifications] Device token: ${deviceToken}`)
|
||||
if(Platform.OS === 'ios') {
|
||||
const apnsToken = await messaging().getAPNSToken()
|
||||
log.trace(`[initNotifications] APNS token: ${apnsToken}`)
|
||||
}
|
||||
|
||||
const {walletProfileStore} = rootStoreInstance
|
||||
if(deviceToken && deviceToken !== walletProfileStore.device) {
|
||||
@@ -107,18 +111,20 @@ const initNotifications = async () => {
|
||||
}
|
||||
})
|
||||
|
||||
notifee.isChannelCreated(DEFAULT_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: DEFAULT_CHANNEL_ID,
|
||||
name: DEFAULT_CHANNEL_NAME,
|
||||
vibration: true,
|
||||
importance: AndroidImportance.HIGH,
|
||||
})
|
||||
}
|
||||
})
|
||||
if(Platform.OS === 'android') {
|
||||
|
||||
notifee.isChannelCreated(NWC_CHANNEL_ID).then(isCreated => {
|
||||
notifee.isChannelCreated(DEFAULT_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: DEFAULT_CHANNEL_ID,
|
||||
name: DEFAULT_CHANNEL_NAME,
|
||||
vibration: true,
|
||||
importance: AndroidImportance.HIGH,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
notifee.isChannelCreated(NWC_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: NWC_CHANNEL_ID,
|
||||
@@ -126,28 +132,40 @@ const initNotifications = async () => {
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
notifee.isChannelCreated(TASK_QUEUE_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: TASK_QUEUE_CHANNEL_ID,
|
||||
name: TASK_QUEUE_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
notifee.isChannelCreated(TEST_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: TEST_CHANNEL_ID,
|
||||
name: TASK_QUEUE_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
})
|
||||
notifee.isChannelCreated(TASK_QUEUE_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: TASK_QUEUE_CHANNEL_ID,
|
||||
name: TASK_QUEUE_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
notifee.isChannelCreated(TEST_CHANNEL_ID).then(isCreated => {
|
||||
if (!isCreated) {
|
||||
notifee.createChannel({
|
||||
id: TEST_CHANNEL_ID,
|
||||
name: TASK_QUEUE_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await notifee.setNotificationCategories([
|
||||
{
|
||||
id: DEFAULT_CHANNEL_ID,
|
||||
},
|
||||
{
|
||||
id: NWC_CHANNEL_ID,
|
||||
},
|
||||
{
|
||||
id: TASK_QUEUE_CHANNEL_ID,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -245,13 +263,15 @@ const _nwcRequestHandler = async function(remoteData: NotifyNwcRequestData) {
|
||||
|
||||
if(!isNwcRequestTaskRunning) {
|
||||
|
||||
const isChannelCreated = await notifee.isChannelCreated(NWC_CHANNEL_ID)
|
||||
if (!isChannelCreated) {
|
||||
await notifee.createChannel({
|
||||
id: NWC_CHANNEL_ID,
|
||||
name: NWC_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
if(Platform.OS === 'android') {
|
||||
const isChannelCreated = await notifee.isChannelCreated(NWC_CHANNEL_ID)
|
||||
if (!isChannelCreated) {
|
||||
await notifee.createChannel({
|
||||
id: NWC_CHANNEL_ID,
|
||||
name: NWC_CHANNEL_NAME,
|
||||
sound: 'default',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await notifee.displayNotification({
|
||||
@@ -266,6 +286,9 @@ const _nwcRequestHandler = async function(remoteData: NotifyNwcRequestData) {
|
||||
indeterminate: true,
|
||||
},
|
||||
},
|
||||
ios: {
|
||||
categoryId: NWC_CHANNEL_ID,
|
||||
},
|
||||
data: {task: HANDLE_NWC_REQUEST_TASK, data: requestEvent}, // Pass the task data to the foreground service
|
||||
})
|
||||
|
||||
@@ -328,6 +351,9 @@ const createForegroundNotification = async function (body: string, data: {task:
|
||||
indeterminate: true,
|
||||
}
|
||||
},
|
||||
ios: {
|
||||
categoryId: TASK_QUEUE_CHANNEL_ID,
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -363,6 +389,9 @@ const createLocalNotification = async function (title: string, body: string, lar
|
||||
id: 'default',
|
||||
},
|
||||
},
|
||||
ios: {
|
||||
categoryId: DEFAULT_CHANNEL_ID,
|
||||
},
|
||||
})
|
||||
|
||||
return notificationId
|
||||
@@ -377,6 +406,9 @@ const createLocalNotification = async function (title: string, body: string, lar
|
||||
id: 'default',
|
||||
},
|
||||
},
|
||||
ios: {
|
||||
categoryId: DEFAULT_CHANNEL_ID,
|
||||
},
|
||||
})
|
||||
|
||||
return notificationId
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"extends": "@react-native/typescript-config/tsconfig.json",
|
||||
// "extends": "@react-native/typescript-config/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react",
|
||||
"typeRoots": ["./src/utils/envtypes"],
|
||||
"lib": ["ES2015"],
|
||||
"paths": {
|
||||
"nostr-tools/*": ["./node_modules/nostr-tools/lib/types/*"]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user