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