From 2af4c049c830dc4b72a8efd305821af9717fa67b Mon Sep 17 00:00:00 2001 From: minibits-cash Date: Tue, 1 Apr 2025 22:20:25 +0200 Subject: [PATCH] iOS images and navi icon --- ios/Podfile.lock | 32 +++++++++++++ ios/minibits_wallet.xcodeproj/project.pbxproj | 10 +++- package.json | 1 + src/components/AvatarHeader.tsx | 6 ++- src/components/Header.tsx | 5 +- src/components/Icon.tsx | 3 +- src/models/NwcStore.ts | 11 +++-- src/screens/ContactDetailScreen.tsx | 3 +- src/screens/Contacts/ContactListItem.tsx | 7 +-- src/screens/Contacts/PublicContacts.tsx | 5 +- src/screens/ContactsScreen.tsx | 3 +- src/screens/MintInfoScreen.tsx | 27 ++++++----- src/screens/OwnKeysScreen.tsx | 3 +- .../PaymentRequestListItem.tsx | 47 ++++++++----------- src/screens/PictureScreen.tsx | 10 ++-- src/screens/SendScreen.tsx | 9 ++-- src/screens/TopupScreen.tsx | 21 ++++----- src/screens/TranDetailScreen.tsx | 5 +- .../Transactions/TransactionListItem.tsx | 5 +- src/screens/WalletScreen.tsx | 3 +- src/services/walletService.ts | 9 ++-- tsconfig.json | 2 +- yarn.lock | 11 +++++ 23 files changed, 151 insertions(+), 87 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 09117c07..4307fba6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -62,6 +62,18 @@ PODS: - hermes-engine (0.79.0-rc.3): - hermes-engine/Pre-built (= 0.79.0-rc.3) - hermes-engine/Pre-built (0.79.0-rc.3) + - libwebp (1.5.0): + - libwebp/demux (= 1.5.0) + - libwebp/mux (= 1.5.0) + - libwebp/sharpyuv (= 1.5.0) + - libwebp/webp (= 1.5.0) + - libwebp/demux (1.5.0): + - libwebp/webp + - libwebp/mux (1.5.0): + - libwebp/demux + - libwebp/sharpyuv (1.5.0) + - libwebp/webp (1.5.0): + - libwebp/sharpyuv - nanopb (3.30910.0): - nanopb/decode (= 3.30910.0) - nanopb/encode (= 3.30910.0) @@ -1971,6 +1983,10 @@ PODS: - React-Core - React-RCTFabric - ReactCommon/turbomodule/core + - RNFastImage (8.6.3): + - React-Core + - SDWebImage (~> 5.11.1) + - SDWebImageWebPCoder (~> 0.8.4) - RNFBApp (21.12.3): - Firebase/CoreOnly (= 11.10.0) - React-Core @@ -2282,6 +2298,12 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga + - SDWebImage (5.11.1): + - SDWebImage/Core (= 5.11.1) + - SDWebImage/Core (5.11.1) + - SDWebImageWebPCoder (0.8.5): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.10) - Sentry/HybridSDK (8.48.0) - SocketRocket (0.7.1) - Yoga (0.0.0) @@ -2368,6 +2390,7 @@ DEPENDENCIES: - ReactNativeCameraKit (from `../node_modules/react-native-camera-kit`) - "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)" - RNExitApp (from `../node_modules/react-native-exit-app`) + - RNFastImage (from `../node_modules/react-native-fast-image`) - "RNFBApp (from `../node_modules/@react-native-firebase/app`)" - "RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`)" - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) @@ -2389,10 +2412,13 @@ SPEC REPOS: - FirebaseMessaging - GoogleDataTransport - GoogleUtilities + - libwebp - nanopb - OpenSSL-Universal - PromisesObjC - React-Codegen + - SDWebImage + - SDWebImageWebPCoder - Sentry - SocketRocket @@ -2556,6 +2582,8 @@ EXTERNAL SOURCES: :path: "../node_modules/@react-native-clipboard/clipboard" RNExitApp: :path: "../node_modules/react-native-exit-app" + RNFastImage: + :path: "../node_modules/react-native-fast-image" RNFBApp: :path: "../node_modules/@react-native-firebase/app" RNFBMessaging: @@ -2593,6 +2621,7 @@ SPEC CHECKSUMS: GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7 GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d hermes-engine: 222573b97e0c0023ee02f5a8480d6aa3080ceb3f + libwebp: 02b23773aedb6ff1fd38cec7a77b81414c6842a8 nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 OpenSSL-Universal: d776ce24dab24323e6995dfb17c64d598885d05c PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 @@ -2669,6 +2698,7 @@ SPEC CHECKSUMS: ReactNativeCameraKit: 7bbc43ee30850444b6086bf5aa3b10e085a38446 RNCClipboard: 055cd8f50702b9ebc5a58f7622e0cda073878d21 RNExitApp: 2f85821d19ae680d29aa2aa27aaba6a2fee5f0e1 + RNFastImage: 462a183c4b0b6b26fdfd639e1ed6ba37536c3b87 RNFBApp: 11d842b835d7e484a306e66e6fd02a13c0478fdc RNFBMessaging: fbb4b994cdd8fbf90d4310008893520628c0ba2d RNGestureHandler: 8ff2b1434b0ff8bab28c8242a656fb842990bbc8 @@ -2678,6 +2708,8 @@ SPEC CHECKSUMS: RNScreens: a25b818417609cbd805474dffd2d28b229704cfc RNSentry: 12d6285a94b3a4fe74d2678ee8cfbbfdba2a3b6c RNSVG: 4470464e129f6bc58b78b961850b054dbbea8ef7 + SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d + SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d Sentry: 1ca8405451040482877dcd344dfa3ef80b646631 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 Yoga: c6ca19219fc9fa053e4c87451b673bc389dcc133 diff --git a/ios/minibits_wallet.xcodeproj/project.pbxproj b/ios/minibits_wallet.xcodeproj/project.pbxproj index 787f25f6..f421b32f 100644 --- a/ios/minibits_wallet.xcodeproj/project.pbxproj +++ b/ios/minibits_wallet.xcodeproj/project.pbxproj @@ -441,7 +441,10 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; @@ -522,7 +525,10 @@ "-DFOLLY_CFG_NO_COROUTINES=1", "-DFOLLY_HAVE_CLOCK_GETTIME=1", ); - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/package.json b/package.json index ac88ab70..41445a67 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "react-native-camera-kit": "14.2.0", "react-native-dotenv": "^3.4.11", "react-native-exit-app": "^2.0.0", + "react-native-fast-image": "^8.6.3", "react-native-flash-message": "^0.4.2", "react-native-gesture-handler": "^2.24.0", "react-native-json-tree": "^1.5.0", diff --git a/src/components/AvatarHeader.tsx b/src/components/AvatarHeader.tsx index a3d747b9..7004edb1 100644 --- a/src/components/AvatarHeader.tsx +++ b/src/components/AvatarHeader.tsx @@ -5,6 +5,8 @@ import { Icon, Text } from "." import { spacing, useThemeColor } from "../theme" import { getImageSource } from '../utils/utils' import { iconRegistry } from '.' +import { log } from "../services" +import FastImage from "react-native-fast-image" export interface AvatarHeaderProps { @@ -26,11 +28,13 @@ export const AvatarHeader = observer(function (props: AvatarHeaderProps) { const headerBg = useThemeColor('header') const borderColor = useThemeColor('border') + // log.trace('AvatarHeader', 'render', { props }) + return ( {props.picture ? ( - ${self.name} - Nostr Wallet Connect`, + Platform.OS === 'android' ? `${self.name} - Nostr Wallet Connect` : `${self.name} - Nostr Wallet Connect`, body + (nwcResponse as NwcError).error.message, nwcPngUrl ) @@ -308,7 +309,7 @@ export const NwcConnectionModel = types.model('NwcConnection', { self.setRemainingDailyLimit(updatedLimit) yield NotificationService.createLocalNotification( - `${self.name} - Nostr Wallet Connect`, + Platform.OS === 'android' ? `${self.name} - Nostr Wallet Connect` : `${self.name} - Nostr Wallet Connect`, `Paid ${result.transaction.amount} SAT${result.transaction.fee > 0 ? ', fee ' + result.transaction.fee + ' SAT' : ''}. Remaining today's limit is ${self.remainingDailyLimit} SAT`, nwcPngUrl ) @@ -458,7 +459,7 @@ export const NwcConnectionModel = types.model('NwcConnection', { } as NwcResponse yield NotificationService.createLocalNotification( - `${self.name} - Nostr Wallet Connect`, + Platform.OS === 'android' ? `${self.name} - Nostr Wallet Connect` : `${self.name} - Nostr Wallet Connect`, `Invoice for ${result.paymentRequest.invoicedAmount} SATS has been created.`, nwcPngUrl ) @@ -790,7 +791,7 @@ export const NwcStoreModel = types //yield NotificationService.stopForegroundService() yield NotificationService.createLocalNotification( - `Nostr Wallet Connect error`, + Platform.OS === 'android' ? `Nostr Wallet Connect error` : `Nostr Wallet Connect error`, message, nwcPngUrl ) @@ -808,7 +809,7 @@ export const NwcStoreModel = types //yield NotificationService.stopForegroundService() yield NotificationService.createLocalNotification( - `Nostr Wallet Connect error`, + Platform.OS === 'android' ? `Nostr Wallet Connect error` : `Nostr Wallet Connect error`, message, nwcPngUrl ) diff --git a/src/screens/ContactDetailScreen.tsx b/src/screens/ContactDetailScreen.tsx index d24de3ee..2fdeb18a 100644 --- a/src/screens/ContactDetailScreen.tsx +++ b/src/screens/ContactDetailScreen.tsx @@ -17,6 +17,7 @@ import { IncomingDataType, IncomingParser } from '../services/incomingParser' import { translate } from '../i18n' import { StaticScreenProps, useNavigation } from '@react-navigation/native' import { toJS } from 'mobx' +import FastImage from 'react-native-fast-image' type Props = StaticScreenProps<{ contact: Contact @@ -187,7 +188,7 @@ export const ContactDetailScreen = observer(function ({ route }: Props) { {picture ? ( - + ) : ( - {/*contact.lud16 && ( @@ -63,7 +64,7 @@ export const ContactListItem = observer(function (props: ContactListProps) { const $iconContainer: ImageStyle = { padding: spacing.extraSmall, - alignSelf: "center", + alignSelf: 'center', marginRight: spacing.medium, } diff --git a/src/screens/Contacts/PublicContacts.tsx b/src/screens/Contacts/PublicContacts.tsx index 82847833..e4a31579 100644 --- a/src/screens/Contacts/PublicContacts.tsx +++ b/src/screens/Contacts/PublicContacts.tsx @@ -18,6 +18,7 @@ import { IncomingDataType, IncomingParser } from '../../services/incomingParser' import { translate } from '../../i18n' import { useNavigation } from '@react-navigation/native' import { toJS } from 'mobx' +import FastImage from 'react-native-fast-image' // const defaultPublicNpub = 'npub14n7frsyufzqsxlvkx8vje22cjah3pcwnnyqncxkuj2243jvt9kmqsdgs52' @@ -456,7 +457,7 @@ export const PublicContacts = observer(function (props: { LeftComponent={ {ownProfile.picture ? ( - @@ -488,7 +489,7 @@ export const PublicContacts = observer(function (props: { LeftComponent={ {item.picture ? ( - diff --git a/src/screens/ContactsScreen.tsx b/src/screens/ContactsScreen.tsx index 0bc9ee9e..dd4eeed9 100644 --- a/src/screens/ContactsScreen.tsx +++ b/src/screens/ContactsScreen.tsx @@ -13,6 +13,7 @@ import { ReceiveOption } from './ReceiveScreen' import { SendOption } from './SendScreen' import { verticalScale } from '@gocodingnow/rn-size-matters' import { StaticScreenProps, useNavigation } from '@react-navigation/native' +import FastImage from 'react-native-fast-image' type Props = StaticScreenProps<{ paymentOption?: ReceiveOption | SendOption @@ -94,7 +95,7 @@ export const LeftProfileHeader = observer(function (props: { return ( {walletProfileStore.picture && props.isAvatarVisible ? ( - ; @@ -159,7 +160,7 @@ export const MintInfoScreen = observer(function MintInfoScreen({ route }: Props) {mintInfo && mintInfo.icon_url ? ( - ))} @@ -222,16 +224,19 @@ export const MintInfoScreen = observer(function MintInfoScreen({ route }: Props) } /> {mintInfo && mintLimitInfo?.any && } - {mintInfo && } - - {mintInfo && } - - } - /> + {mintInfo && + <> + + + {mintInfo && } + + } + /> + + } {mintInfo && } @@ -277,7 +278,7 @@ export const OwnKeysScreen = observer(function OwnKeysScreen({ route }: Props) { LeftComponent={ {ownProfile.picture ? ( - diff --git a/src/screens/PaymentRequests/PaymentRequestListItem.tsx b/src/screens/PaymentRequests/PaymentRequestListItem.tsx index de5e9ac8..8bf46599 100644 --- a/src/screens/PaymentRequests/PaymentRequestListItem.tsx +++ b/src/screens/PaymentRequests/PaymentRequestListItem.tsx @@ -25,6 +25,7 @@ import { CurrencyAmount } from '../Wallet/CurrencyAmount' import { useNavigation } from '@react-navigation/native' import { MintUnit } from '../../services/wallet/currency' import { toJS } from 'mobx' +import FastImage from 'react-native-fast-image' export interface PaymentRequestListProps { pr: PaymentRequest @@ -116,19 +117,16 @@ export const PaymentRequestListItem = observer(function PaymentRequestListItem( alignItems: 'center', width: 100, }}> - + {pr.contactFrom.picture ? ( - ) : ( diff --git a/src/screens/PictureScreen.tsx b/src/screens/PictureScreen.tsx index d9d06e07..56385493 100644 --- a/src/screens/PictureScreen.tsx +++ b/src/screens/PictureScreen.tsx @@ -1,16 +1,17 @@ -import {observer} from 'mobx-react-lite' import React, {FC, useEffect, useState} from 'react' -import {Image, Pressable, TextStyle, View, ViewStyle} from 'react-native' +import {Pressable, TextStyle, View, ViewStyle} from 'react-native' +import FastImage from 'react-native-fast-image' import {colors, spacing, useThemeColor} from '../theme' import {Button, Card, ErrorModal, Header, InfoModal, ListItem, Loading, Screen, Text} from '../components' import {useStores} from '../models' -import { MinibitsClient} from '../services' +import { log, MinibitsClient} from '../services' import AppError from '../utils/AppError' import { ProfileHeader } from '../components/ProfileHeader' import { scale } from '@gocodingnow/rn-size-matters' import { getImageSource } from '../utils/utils' import { StaticScreenProps, useNavigation } from '@react-navigation/native' + type Props = StaticScreenProps export const PictureScreen = (function PictureScreen({ route }: Props) { @@ -75,13 +76,14 @@ export const PictureScreen = (function PictureScreen({ route }: Props) { {pictures.map((png, index) => { + // log.trace('PictureScreen', 'png', png) return ( onPictureSelect(png)} style={(png === selectedPicture) ? [$unselected, {borderColor: selectedColor}] : $unselected} > - + ) })} diff --git a/src/screens/SendScreen.tsx b/src/screens/SendScreen.tsx index b5874814..fb128a0b 100644 --- a/src/screens/SendScreen.tsx +++ b/src/screens/SendScreen.tsx @@ -60,6 +60,7 @@ import { PaymentRequest as CashuPaymentRequest, PaymentRequestTransport, Payment import { ProfilePointer } from 'nostr-tools/nip19' import { MINIBITS_NIP05_DOMAIN } from '@env' import { SEND_TASK } from '../services/wallet/sendTask' +import FastImage from 'react-native-fast-image' export enum SendOption { SEND_TOKEN = 'SEND_TOKEN', @@ -1284,12 +1285,12 @@ const NostDMInfoBlock = observer(function (props: { return( - {props.contactToSendTo.picture ? ( - - {props.contactToSendTo.picture ? ( - {profilePicture ? ( - ):( - {profile.picture ? ( - ) : ( - - diff --git a/src/services/walletService.ts b/src/services/walletService.ts index 63ae9f37..772ca1a3 100644 --- a/src/services/walletService.ts +++ b/src/services/walletService.ts @@ -35,6 +35,7 @@ import { MintUnit, formatCurrency, getCurrency } from './wallet/currency' import { MinibitsClient } from './minibitsService' import { KeyChain } from './keyChain' import { UnsignedEvent } from 'nostr-tools' +import { Platform } from 'react-native' /** * The default number of proofs per denomination to keep in a wallet. @@ -2030,7 +2031,7 @@ const receiveEventsFromRelaysQueue = async function (): Promise { log.trace('[receiveEventsFromRelays]', `Eose: Got ${eventsBatch.length} receive events`) const connections = pool.listConnectionStatus() - for (const conn of connections) { + for (const conn of Array.from(connections)) { const relayInstance = relaysStore.findByUrl(conn[0]) if(conn[1] === true) { log.trace('[receiveEventsFromRelays] Connection is OPEN', {conn: conn[0]}) @@ -2287,8 +2288,8 @@ const _sendReceiveNotification = async function ( const currencyCode = getCurrency(unit).code if(receivedAmount && receivedAmount > 0) { await NotificationService.createLocalNotification( - `⚡${formatCurrency(receivedAmount, currencyCode)} ${currencyCode} received!`, - `${isZap ? 'Zap' : 'Ecash'} from ${sentFrom || 'unknown payer'} is now in your wallet.`, + Platform.OS === 'android' ? `⚡${formatCurrency(receivedAmount, currencyCode)} ${currencyCode} received!` : `⚡${formatCurrency(receivedAmount, currencyCode)} ${currencyCode} received!`, + Platform.OS === 'android' ? `${isZap ? 'Zap' : 'Ecash'} from ${sentFrom || 'unknown payer'} is now in your wallet.` : `${isZap ? 'Zap' : 'Ecash'} from ${sentFrom || 'unknown payer'} is now in your wallet.`, sentFromPicture ) } @@ -2299,7 +2300,7 @@ const _sendReceiveNotification = async function ( const _sendPaymentRequestNotification = async function (pr: PaymentRequest) { await NotificationService.createLocalNotification( - `⚡ Please pay ${formatCurrency(pr.invoicedAmount, getCurrency(pr.invoicedUnit!).code)} ${getCurrency(pr.invoicedUnit!).code}!`, + Platform.OS === 'android' ? `⚡ Please pay ${formatCurrency(pr.invoicedAmount, getCurrency(pr.invoicedUnit!).code)} ${getCurrency(pr.invoicedUnit!).code}!` : `⚡ Please pay ${formatCurrency(pr.invoicedAmount, getCurrency(pr.invoicedUnit!).code)} ${getCurrency(pr.invoicedUnit!).code}!`, `${pr.contactFrom.nip05 || 'Unknown'} has sent you a request to pay an invoice.`, pr.contactFrom.picture, ) diff --git a/tsconfig.json b/tsconfig.json index 01f20ed5..0ed282f9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "jsx": "react", "typeRoots": ["./src/utils/envtypes"], - "lib": ["ES2015"], + "lib": ["ES2017"], "paths": { "nostr-tools/*": ["./node_modules/nostr-tools/lib/types/*"] }, diff --git a/yarn.lock b/yarn.lock index 2404f987..7e6111fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9239,6 +9239,7 @@ __metadata: react-native-clean-project: ^4.0.3 react-native-dotenv: ^3.4.11 react-native-exit-app: ^2.0.0 + react-native-fast-image: ^8.6.3 react-native-flash-message: ^0.4.2 react-native-gesture-handler: ^2.24.0 react-native-json-tree: ^1.5.0 @@ -10438,6 +10439,16 @@ __metadata: languageName: node linkType: hard +"react-native-fast-image@npm:^8.6.3": + version: 8.6.3 + resolution: "react-native-fast-image@npm:8.6.3" + peerDependencies: + react: ^17 || ^18 + react-native: ">=0.60.0" + checksum: 29289cb6b2eae0983c8922b22e2d9de3be07322bb7991c5def19f95eadefaedb0e308ff0b38cc1d0444e8bd4fe94a7621a99a2d3d9298100bcb60b3144677234 + languageName: node + linkType: hard + "react-native-flash-message@npm:^0.4.2": version: 0.4.2 resolution: "react-native-flash-message@npm:0.4.2"