Optimize sending locked ecash, small UI fixes

This commit is contained in:
minibits-cash
2025-04-22 22:58:47 +02:00
parent e09db474ae
commit cf0c374b75
11 changed files with 83 additions and 78 deletions
-1
View File
@@ -37,4 +37,3 @@ newArchEnabled=true
# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
@@ -301,7 +301,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = minibits_wallet/minibits_wallet.entitlements;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = GR2ZKMCLAM;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = minibits_wallet/Info.plist;
@@ -336,7 +336,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = minibits_wallet/minibits_wallet.entitlements;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = GR2ZKMCLAM;
INFOPLIST_FILE = minibits_wallet/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Minibits;
@@ -31,7 +31,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "minibits_wallet",
"version": "0.2.2-beta.9",
"version": "0.2.2-beta.10",
"private": true,
"scripts": {
"android:clean": "cd android && ./gradlew clean",
+9 -3
View File
@@ -1,6 +1,6 @@
import {observer} from 'mobx-react-lite'
import React, {FC, useRef, useState} from 'react'
import {Image, ScrollView, Share, TextInput, TextStyle, View, ViewStyle} from 'react-native'
import {Image, Platform, ScrollView, Share, TextInput, TextStyle, View, ViewStyle} from 'react-native'
import { colors, spacing, useThemeColor} from '../theme'
import {Icon, Screen, Text, Card, BottomModal, Button, InfoModal, ErrorModal, ListItem} from '../components'
import {useHeader} from '../utils/useHeader'
@@ -148,8 +148,14 @@ export const ContactDetailScreen = observer(function ({ route }: Props) {
setInfo(translate("syncCompleted"))
return
} catch (e: any) {
toggleContactModal()
handleError(e)
toggleContactModal()
if(Platform.OS === 'ios') {
setTimeout(() => {
handleError(e)
}, 500)
} else {
handleError(e)
}
}
}
+11 -32
View File
@@ -351,7 +351,7 @@ export const OwnName = observer(function (props: {pubkey: string}) {
text='Minibits'
style={{fontFamily: 'Gluten-Regular', fontSize: 18}}
/>{' '}
kindly asks you for a small donation for your {ownName+MINIBITS_NIP05_DOMAIN} wallet address.
kindly asks you for a small donation for your new wallet address.
</RNText>
<CurrencyAmount
amount={DEFAULT_DONATION_AMOUNT}
@@ -405,10 +405,11 @@ export const OwnName = observer(function (props: {pubkey: string}) {
onPress={resetState}
/>
</View>
<View style={{flexDirection: 'row', alignItems: 'center', margin: spacing.medium}}>
<Icon icon='faInfoCircle' />
<Text style={{color: hint}} size='xxs' tx='contactsScreen.ownName.betaWarning'/>
</View>
<ListItem
textStyle={{fontSize: 12, color: hint}}
leftIcon='faInfoCircle'
tx='contactsScreen.ownName.betaWarning'
/>
</>
)}
</View>
@@ -448,12 +449,14 @@ export const OwnName = observer(function (props: {pubkey: string}) {
const $screen: ViewStyle = {
// flex: 1
}
const $contentContainer: TextStyle = {
// flex:1,
padding: spacing.extraSmall,
//marginBottom: spacing.medium
}
const $iconContainer: ViewStyle = {
@@ -463,12 +466,12 @@ const $iconContainer: ViewStyle = {
const $supportText: TextStyle = {
padding: spacing.small,
// textAlign: 'center',
textAlign: 'center',
fontSize: 16,
}
const $card: ViewStyle = {
marginBottom: 0,
//marginBottom: 0,
}
const $payButtonContainer: ViewStyle = {
@@ -513,33 +516,9 @@ const $buttonContainer: ViewStyle = {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
marginVertical: spacing.small,
marginVertical: spacing.extraSmall,
}
const $ownNameButton: ViewStyle = {
maxHeight: 50,
}
const $invoiceContainer: ViewStyle = {
borderRadius: spacing.small,
alignSelf: 'stretch',
padding: spacing.small,
maxHeight: 150,
marginTop: spacing.small,
marginBottom: spacing.large,
}
const $qrCodeContainer: ViewStyle = {
alignItems: 'center',
backgroundColor: 'white',
paddingHorizontal: spacing.small,
marginHorizontal: spacing.small,
marginBottom: spacing.small,
borderRadius: spacing.small
}
const $bottomModal: ViewStyle = {
alignItems: 'center',
paddingVertical: spacing.large,
}
+5 -3
View File
@@ -219,18 +219,19 @@ export const PrivateContacts = observer(function (props: {
encoded: contact.lud16
}, navigation, userSettingsStore.preferredUnit)
//reset
//@ts-ignore
navigation.setParams({
paymentOption: undefined,
})
return
}
//@ts-ignore
navigation.navigate('ContactDetail', {contact: toJS(contact)})
} catch (e: any) {
// reset so that invalid contact can be deleted
//@ts-ignore
navigation.setParams({
paymentOption: undefined,
})
@@ -239,7 +240,8 @@ export const PrivateContacts = observer(function (props: {
}
}
const gotoProfile = function () {
const gotoProfile = function () {
//@ts-ignore
navigation.navigate('Profile')
}
+7 -4
View File
@@ -1,6 +1,6 @@
import {observer} from 'mobx-react-lite'
import React, {FC, useRef, useState} from 'react'
import {Alert, ScrollView, TextInput, TextStyle, View, ViewStyle} from 'react-native'
import {Alert, Platform, ScrollView, TextInput, TextStyle, View, ViewStyle} from 'react-native'
import Clipboard from '@react-native-clipboard/clipboard'
import {
MINIBITS_MINT_URL
@@ -272,10 +272,13 @@ export const MintsScreen = observer(function MintsScreen({ route }: Props) {
const onShare = function () {
if (!selectedMint) return
toggleMintMenuModal()
setTimeout(() => {
if(Platform.OS === 'ios') {
setTimeout(() => {
toggleShareModal()
}, 500)
} else {
toggleShareModal()
}, 500)
}
}
const handleError = function (e: AppError) {
+13 -5
View File
@@ -1,6 +1,6 @@
import {observer} from 'mobx-react-lite'
import React, {FC, useEffect, useState} from 'react'
import {ScrollView, Share, Switch, TextStyle, View, ViewStyle} from 'react-native'
import {Platform, ScrollView, Share, Switch, TextStyle, View, ViewStyle} from 'react-native'
import {colors, spacing, useThemeColor} from '../theme'
import {Icon, ListItem, Screen, Text, Card, BottomModal, Button, InfoModal, ErrorModal, Loading, Header} from '../components'
import {useStores} from '../models'
@@ -83,9 +83,13 @@ export const ProfileScreen = observer(function ProfileScreen({ route }: Props) {
data: npub,
})
setTimeout(() => {
if(Platform.OS === 'ios') {
setTimeout(() => {
toggleQrCodeModal()
}, 500) // ios fix
} else {
toggleQrCodeModal()
}, 500) // ios fix
}
}
@@ -96,9 +100,13 @@ export const ProfileScreen = observer(function ProfileScreen({ route }: Props) {
data: pubkey,
})
setTimeout(() => {
if(Platform.OS === 'ios') {
setTimeout(() => {
toggleQrCodeModal()
}, 500) // ios fix
} else {
toggleQrCodeModal()
}, 500) // ios fix
}
}
const onCopyNip05 = function () {
+9 -2
View File
@@ -160,7 +160,13 @@ export const RecoveryOptionsScreen = observer(function RecoveryOptionsScreen({ r
toggleMintSelectorModal()
if(mintBalanceToMintFrom) {
toggleMintQuoteModal()
if(Platform.OS === 'ios') {
setTimeout(() => {
toggleMintQuoteModal()
}, 500)
} else {
toggleMintQuoteModal()
}
}
}
@@ -467,13 +473,14 @@ const $contentContainer: TextStyle = {
const $mintsContainer: TextStyle = {
// flex: 1,
alignSelf: 'stretch',
minHeight: spacing.screenHeight * 0.15,
minHeight: spacing.screenHeight * 0.4,
}
const $quoteContainer: TextStyle = {
// flex: 1,
padding: spacing.small,
alignSelf: 'stretch',
minHeight: spacing.screenHeight * 0.3,
}
const $pasteButton: ViewStyle = {
+25 -24
View File
@@ -619,6 +619,28 @@ const togglePubkeySelectorModal = () => setIsPubkeySelectorModalVisible(previous
throw new AppError(Err.VALIDATION_ERROR, 'Invalid key. Please provide public key in NPUB or HEX format.')
}
const contact = contactsStore.findByNpub(lockedPubkey) || contactsStore.findByPubkey(lockedPubkey)
if(contact) {
log.trace('[onLockPubkeySelect] Provided pubkey belongs to a contact', {contactName: contact.name})
let relays: string[] = []
if(contact?.type === ContactType.PUBLIC) {
relays = relaysStore.allPublicUrls
} else {
relays = relaysStore.allUrls
}
if (relays.length === 0) {
throw new AppError(Err.VALIDATION_ERROR, 'Missing NOSTR relays')
}
setPaymentOption(SendOption.SEND_TOKEN)
setContactToSendFrom(getContactFrom())
setContactToSendTo(contact)
setRelaysToShareTo(relays)
}
setIsLockedToPubkey(true)
togglePubkeySelectorModal()
}
@@ -626,6 +648,7 @@ const togglePubkeySelectorModal = () => setIsPubkeySelectorModalVisible(previous
const onLockPubkeyCancel = function () {
togglePubkeySelectorModal()
setLockedPubkey(undefined)
setContactToSendTo(undefined)
}
@@ -840,32 +863,10 @@ const togglePubkeySelectorModal = () => setIsPubkeySelectorModalVisible(previous
}
const gotoContacts = function () {
if(encodedTokenToSend &&
lockedPubkey &&
contactsStore.contacts.some(c => c.pubkey === lockedPubkey
)) {
const contact = contactsStore.findByPubkey(lockedPubkey)
let relays: string[] = []
if(encodedTokenToSend && contactToSendTo) {
if(contact?.type === ContactType.PUBLIC) {
relays = relaysStore.allPublicUrls
} else {
relays = relaysStore.allUrls
}
if (relays.length === 0) {
throw new AppError(Err.VALIDATION_ERROR, 'Missing NOSTR relays')
}
setPaymentOption(SendOption.SEND_TOKEN)
setContactToSendFrom(getContactFrom())
setContactToSendTo(contact)
setRelaysToShareTo(relays)
if(encodedTokenToSend) {
toggleNostrDMModal() // open if we already have a token
}
toggleNostrDMModal() // open if we already have a token
} else {
//@ts-ignore