Offline and Contacts fixes

This commit is contained in:
KoalaSat 2023-12-12 00:26:27 +01:00
parent b04544cfd9
commit c2fcbfeca8
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
17 changed files with 102 additions and 86 deletions

View File

@ -26,6 +26,10 @@ jobs:
https://github.com/KoalaSat/nostros/releases/download/${{ github.ref_name }}/nostros-${{ github.ref_name }}-universal.apk https://github.com/KoalaSat/nostros/releases/download/${{ github.ref_name }}/nostros-${{ github.ref_name }}-universal.apk
**Torrent**
https://github.com/KoalaSat/nostros/releases/download/${{ github.ref_name }}/nostros-${{ github.ref_name }}-universal.torrent
**Changelog** **Changelog**
https://github.com/KoalaSat/nostros/releases/${{ github.ref_name }} https://github.com/KoalaSat/nostros/releases/${{ github.ref_name }}
@ -76,3 +80,12 @@ jobs:
asset_path: app-armeabi-v7a-release.apk asset_path: app-armeabi-v7a-release.apk
asset_name: nostros-${{ github.ref_name }}-armeabi-v7a.apk asset_name: nostros-${{ github.ref_name }}-armeabi-v7a.apk
asset_content_type: application/apk asset_content_type: application/apk
- name: Install torf-cli
run: sudo pip3 install torf-cli
- name: Create torrent using torf-cli
run: torf "nostros-${{ github.ref_name }}-universal.apk" -o "nostros-${{ github.ref_name }}-universal.torrent" -w "https://github.com/KoalaSat/nostros/releases/download/${{ github.ref_name }}/nostros-${{ github.ref_name }}-universal.apk" -s "torrent-webseed-creator"
- name: Upload torrent file
uses: actions/upload-artifact@v3
with:
name: Torrent
path: nostros-${{ github.ref_name }}-universal.torrent

View File

@ -132,7 +132,7 @@ export const MenuItems: React.FC = () => {
/> />
</TouchableRipple> </TouchableRipple>
<View style={styles.cardEdit}> <View style={styles.cardEdit}>
{privateKey && ( {privateKey && online && (
<IconButton <IconButton
icon='pencil-outline' icon='pencil-outline'
size={20} size={20}

View File

@ -306,7 +306,7 @@ export const NoteCard: React.FC<NoteCardProps> = ({
<View style={styles.reactionsPopupContent}> <View style={styles.reactionsPopupContent}>
<Button <Button
onPress={() => { onPress={() => {
if (!userDownvoted && privateKey) { if (!userDownvoted && privateKey && online) {
setUserDownvoted(true) setUserDownvoted(true)
setNegativeReactions((prev) => prev + 1) setNegativeReactions((prev) => prev + 1)
publishReaction(false) publishReaction(false)
@ -325,7 +325,7 @@ export const NoteCard: React.FC<NoteCardProps> = ({
</Button> </Button>
<Button <Button
onPress={() => { onPress={() => {
if (!userUpvoted && privateKey) { if (!userUpvoted && privateKey && online) {
setUserUpvoted(true) setUserUpvoted(true)
setPositiveReactions((prev) => prev + 1) setPositiveReactions((prev) => prev + 1)
publishReaction(true) publishReaction(true)

View File

@ -47,7 +47,6 @@ export interface AppContextProps {
setClipboardNip21: (clipboardNip21: string | undefined) => void setClipboardNip21: (clipboardNip21: string | undefined) => void
checkClipboard: () => void checkClipboard: () => void
displayUserDrawer?: string displayUserDrawer?: string
setDisplayUserDrawer: (displayUserDrawer: string | undefined) => void
displayNoteDrawer?: string displayNoteDrawer?: string
refreshBottomBarAt?: number refreshBottomBarAt?: number
setRefreshBottomBarAt: (refreshBottomBarAt: number) => void setRefreshBottomBarAt: (refreshBottomBarAt: number) => void
@ -98,7 +97,6 @@ export const initialAppContext: AppContextProps = {
getImageHostingService: () => '', getImageHostingService: () => '',
getSatoshiSymbol: () => <></>, getSatoshiSymbol: () => <></>,
setClipboardNip21: () => {}, setClipboardNip21: () => {},
setDisplayUserDrawer: () => {},
longPressZap: undefined, longPressZap: undefined,
setLongPressZap: () => {}, setLongPressZap: () => {},
signHeight: false, signHeight: false,
@ -130,7 +128,6 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
const [loadingDb, setLoadingDb] = useState<boolean>(initialAppContext.loadingDb) const [loadingDb, setLoadingDb] = useState<boolean>(initialAppContext.loadingDb)
const [clipboardLoads, setClipboardLoads] = React.useState<string[]>([]) const [clipboardLoads, setClipboardLoads] = React.useState<string[]>([])
const [clipboardNip21, setClipboardNip21] = React.useState<string>() const [clipboardNip21, setClipboardNip21] = React.useState<string>()
const [displayUserDrawer, setDisplayUserDrawer] = React.useState<string>()
const [pushedTab, setPushedTab] = useState<string>() const [pushedTab, setPushedTab] = useState<string>()
const [signHeight, setSignWithHeight] = useState<boolean>(initialAppContext.signHeight) const [signHeight, setSignWithHeight] = useState<boolean>(initialAppContext.signHeight)
const [online, setOnline] = React.useState<boolean>(initialAppContext.online) const [online, setOnline] = React.useState<boolean>(initialAppContext.online)
@ -249,8 +246,6 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
value={{ value={{
relayColouring, relayColouring,
setRelayColouring, setRelayColouring,
displayUserDrawer,
setDisplayUserDrawer,
language, language,
setLanguage, setLanguage,
checkClipboard, checkClipboard,

View File

@ -35,6 +35,7 @@ export const dropTables: (db: QuickSQLiteConnection) => Promise<BatchQueryResult
['DELETE FROM nostros_reactions;', [[]]], ['DELETE FROM nostros_reactions;', [[]]],
['DELETE FROM nostros_relays;', [[]]], ['DELETE FROM nostros_relays;', [[]]],
['DELETE FROM nostros_notes_relays;', [[]]], ['DELETE FROM nostros_notes_relays;', [[]]],
['DELETE FROM nostros_relay_metadata;', [[]]],
['DELETE FROM nostros_direct_messages;', [[]]], ['DELETE FROM nostros_direct_messages;', [[]]],
['DELETE FROM nostros_group_meta;', [[]]], ['DELETE FROM nostros_group_meta;', [[]]],
['DELETE FROM nostros_group_messages;', [[]]], ['DELETE FROM nostros_group_messages;', [[]]],

View File

@ -32,17 +32,17 @@ import ProfileData from '../../Components/ProfileData'
import { handleInfinityScroll } from '../../Functions/NativeFunctions' import { handleInfinityScroll } from '../../Functions/NativeFunctions'
import DatabaseModule from '../../lib/Native/DatabaseModule' import DatabaseModule from '../../lib/Native/DatabaseModule'
import { removeMutedUsersList } from '../../Functions/RelayFunctions/Lists' import { removeMutedUsersList } from '../../Functions/RelayFunctions/Lists'
import { push } from '../../lib/Navigation'
export const ContactsPage: React.FC = () => { export const ContactsPage: React.FC = () => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
const theme = useTheme() const theme = useTheme()
const initialPageSize = 20 const initialPageSize = 20
const { database, setDisplayUserDrawer, qrReader, setQrReader, online } = useContext(AppContext) const { database, qrReader, setQrReader, online } = useContext(AppContext)
const { privateKey, publicKey, nPub, mutedUsers, reloadLists } = React.useContext(UserContext) const { privateKey, publicKey, nPub, mutedUsers, reloadLists } = React.useContext(UserContext)
const { relayPool, lastEventId, sendEvent } = useContext(RelayPoolContext) const { relayPool, lastEventId, sendEvent } = useContext(RelayPoolContext)
const [pageSize, setPageSize] = useState<number>(initialPageSize) const [pageSize, setPageSize] = useState<number>(initialPageSize)
const bottomSheetAddContactRef = React.useRef<RBSheet>(null) const bottomSheetAddContactRef = React.useRef<RBSheet>(null)
const bottomSheetProfileRef = React.useRef<RBSheet>(null)
// State // State
const [followers, setFollowers] = useState<User[]>([]) const [followers, setFollowers] = useState<User[]>([])
const [following, setFollowing] = useState<User[]>([]) const [following, setFollowing] = useState<User[]>([])
@ -208,10 +208,7 @@ export const ContactsPage: React.FC = () => {
const renderContactItem: ListRenderItem<User> = ({ index, item }) => { const renderContactItem: ListRenderItem<User> = ({ index, item }) => {
return ( return (
<TouchableRipple <TouchableRipple
onPress={() => { onPress={() => push('ProfileActions', { userId: item.id, title: item?.name })}
setDisplayUserDrawer(item.id)
bottomSheetProfileRef.current?.open()
}}
> >
<View key={item.id} style={styles.contactRow}> <View key={item.id} style={styles.contactRow}>
<View style={styles.profileData}> <View style={styles.profileData}>
@ -238,10 +235,7 @@ export const ContactsPage: React.FC = () => {
const renderMutedItem: ListRenderItem<User> = ({ index, item }) => { const renderMutedItem: ListRenderItem<User> = ({ index, item }) => {
return ( return (
<TouchableRipple <TouchableRipple
onPress={() => { onPress={() => push('ProfileActions', { userId: item.id, title: item?.name })}
setDisplayUserDrawer(item.id)
bottomSheetProfileRef.current?.open()
}}
> >
<View key={item.id} style={styles.contactRow}> <View key={item.id} style={styles.contactRow}>
<View style={styles.profileData}> <View style={styles.profileData}>

View File

@ -41,6 +41,7 @@ import UploadImage from '../../Components/UploadImage'
import { Swipeable } from 'react-native-gesture-handler' import { Swipeable } from 'react-native-gesture-handler'
import { getETags } from '../../Functions/RelayFunctions/Events' import { getETags } from '../../Functions/RelayFunctions/Events'
import DatabaseModule from '../../lib/Native/DatabaseModule' import DatabaseModule from '../../lib/Native/DatabaseModule'
import { push } from '../../lib/Navigation'
interface ConversationPageProps { interface ConversationPageProps {
route: { params: { pubKey: string; conversationId: string } } route: { params: { pubKey: string; conversationId: string } }
@ -50,8 +51,8 @@ export const ConversationPage: React.FC<ConversationPageProps> = ({ route }) =>
const initialPageSize = 10 const initialPageSize = 10
const theme = useTheme() const theme = useTheme()
const scrollViewRef = useRef<ScrollView>() const scrollViewRef = useRef<ScrollView>()
const { database, setRefreshBottomBarAt, setDisplayUserDrawer } = useContext(AppContext) const { database, setRefreshBottomBarAt, online } = useContext(AppContext)
const { relayPool, lastEventId, sendEvent, online } = useContext(RelayPoolContext) const { relayPool, lastEventId, sendEvent } = useContext(RelayPoolContext)
const { publicKey, privateKey, name, picture, validNip05 } = useContext(UserContext) const { publicKey, privateKey, name, picture, validNip05 } = useContext(UserContext)
const otherPubKey = useMemo(() => route.params.pubKey, []) const otherPubKey = useMemo(() => route.params.pubKey, [])
const [pageSize, setPageSize] = useState<number>(initialPageSize) const [pageSize, setPageSize] = useState<number>(initialPageSize)
@ -254,7 +255,7 @@ export const ConversationPage: React.FC<ConversationPageProps> = ({ route }) =>
<TextContent <TextContent
content={message?.content} content={message?.content}
event={message} event={message}
onPressUser={(user) => setDisplayUserDrawer(user.id)} onPressUser={(user) => push('ProfileActions', { userId: user.id, title: user?.name })}
copyText copyText
/> />
) : ( ) : (
@ -292,7 +293,7 @@ export const ConversationPage: React.FC<ConversationPageProps> = ({ route }) =>
{publicKey !== item.pubkey && ( {publicKey !== item.pubkey && (
<View style={styles.pictureSpaceLeft}> <View style={styles.pictureSpaceLeft}>
{showAvatar && ( {showAvatar && (
<TouchableRipple onPress={() => setDisplayUserDrawer(otherPubKey)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: otherUser.id, title: otherUser.name })}>
<NostrosAvatar <NostrosAvatar
name={otherUser.name} name={otherUser.name}
pubKey={otherPubKey} pubKey={otherPubKey}
@ -334,7 +335,7 @@ export const ConversationPage: React.FC<ConversationPageProps> = ({ route }) =>
{publicKey === item.pubkey && ( {publicKey === item.pubkey && (
<View style={styles.pictureSpaceRight}> <View style={styles.pictureSpaceRight}>
{showAvatar && ( {showAvatar && (
<TouchableRipple onPress={() => setDisplayUserDrawer(publicKey)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: publicKey, title: name })}>
<NostrosAvatar name={name} pubKey={publicKey} src={picture} size={40} /> <NostrosAvatar name={name} pubKey={publicKey} src={picture} size={40} />
</TouchableRipple> </TouchableRipple>
)} )}
@ -400,7 +401,7 @@ export const ConversationPage: React.FC<ConversationPageProps> = ({ route }) =>
<TextContent <TextContent
content={reply.content} content={reply.content}
event={reply} event={reply}
onPressUser={(user) => setDisplayUserDrawer(user.id)} onPressUser={(user) => push('ProfileActions', { userId: user.id, title: user?.name })}
showPreview={false} showPreview={false}
numberOfLines={3} numberOfLines={3}
/> />

View File

@ -38,6 +38,7 @@ import ProfileData from '../../Components/ProfileData'
import { ScrollView, Swipeable } from 'react-native-gesture-handler' import { ScrollView, Swipeable } from 'react-native-gesture-handler'
import { getETags } from '../../Functions/RelayFunctions/Events' import { getETags } from '../../Functions/RelayFunctions/Events'
import DatabaseModule from '../../lib/Native/DatabaseModule' import DatabaseModule from '../../lib/Native/DatabaseModule'
import { push } from '../../lib/Navigation'
interface GroupPageProps { interface GroupPageProps {
route: { params: { groupId: string } } route: { params: { groupId: string } }
@ -46,7 +47,7 @@ interface GroupPageProps {
export const GroupPage: React.FC<GroupPageProps> = ({ route }) => { export const GroupPage: React.FC<GroupPageProps> = ({ route }) => {
const initialPageSize = 20 const initialPageSize = 20
const theme = useTheme() const theme = useTheme()
const { database, setDisplayUserDrawer, online } = useContext(AppContext) const { database, online } = useContext(AppContext)
const { relayPool, lastEventId, sendEvent } = useContext(RelayPoolContext) const { relayPool, lastEventId, sendEvent } = useContext(RelayPoolContext)
const { publicKey, privateKey, name, picture, validNip05 } = useContext(UserContext) const { publicKey, privateKey, name, picture, validNip05 } = useContext(UserContext)
const [pageSize, setPageSize] = useState<number>(initialPageSize) const [pageSize, setPageSize] = useState<number>(initialPageSize)
@ -308,7 +309,7 @@ export const GroupPage: React.FC<GroupPageProps> = ({ route }) => {
<TextContent <TextContent
content={message?.content} content={message?.content}
event={message} event={message}
onPressUser={(user) => setDisplayUserDrawer(user.id)} onPressUser={(user) => push('ProfileActions', { userId: user.id, title: user?.name })}
copyText copyText
/> />
) : ( ) : (
@ -335,7 +336,7 @@ export const GroupPage: React.FC<GroupPageProps> = ({ route }) => {
{publicKey !== item.pubkey && ( {publicKey !== item.pubkey && (
<View style={styles.pictureSpaceLeft}> <View style={styles.pictureSpaceLeft}>
{showAvatar && ( {showAvatar && (
<TouchableRipple onPress={() => setDisplayUserDrawer(item.pubkey)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: item.id, title: item?.name })}>
<NostrosAvatar <NostrosAvatar
name={displayName(item)} name={displayName(item)}
pubKey={item.pubkey} pubKey={item.pubkey}
@ -379,7 +380,7 @@ export const GroupPage: React.FC<GroupPageProps> = ({ route }) => {
{publicKey === item.pubkey && ( {publicKey === item.pubkey && (
<View style={styles.pictureSpaceRight}> <View style={styles.pictureSpaceRight}>
{showAvatar && ( {showAvatar && (
<TouchableRipple onPress={() => setDisplayUserDrawer(publicKey)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: publicKey, title: name })}>
<NostrosAvatar name={name} pubKey={publicKey} src={picture} size={40} /> <NostrosAvatar name={name} pubKey={publicKey} src={picture} size={40} />
</TouchableRipple> </TouchableRipple>
)} )}
@ -435,7 +436,7 @@ export const GroupPage: React.FC<GroupPageProps> = ({ route }) => {
<TextContent <TextContent
content={reply.content} content={reply.content}
event={reply} event={reply}
onPressUser={(user) => setDisplayUserDrawer(user.id)} onPressUser={(user) => push('ProfileActions', { userId: user.id, title: user?.name })}
showPreview={false} showPreview={false}
numberOfLines={3} numberOfLines={3}
/> />

View File

@ -282,15 +282,17 @@ export const ConversationsFeed: React.FC = () => {
</Button> </Button>
</View> </View>
)} )}
<AnimatedFAB {privateKey && online && (
style={[styles.fab, { top: Dimensions.get('window').height - 191 }]} <AnimatedFAB
icon='pencil-outline' style={[styles.fab, { top: Dimensions.get('window').height - 191 }]}
label='Label' icon='pencil-outline'
onPress={() => bottomSheetCreateRef.current?.open()} label='Label'
animateFrom='right' onPress={() => bottomSheetCreateRef.current?.open()}
iconMode='static' animateFrom='right'
extended={false} iconMode='static'
/> extended={false}
/>
)}
<RBSheet ref={bottomSheetCreateRef} closeOnDragDown={true} customStyles={bottomSheetStyles}> <RBSheet ref={bottomSheetCreateRef} closeOnDragDown={true} customStyles={bottomSheetStyles}>
<FlatList <FlatList
data={createOptions} data={createOptions}

View File

@ -42,7 +42,7 @@ export const GroupsFeed: React.FC = () => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
const theme = useTheme() const theme = useTheme()
const { database, qrReader, setQrReader, refreshBottomBarAt, online } = useContext(AppContext) const { database, qrReader, setQrReader, refreshBottomBarAt, online } = useContext(AppContext)
const { publicKey } = useContext(UserContext) const { publicKey, privateKey } = useContext(UserContext)
const { relayPool, lastEventId, lastConfirmationtId, sendEvent, setNewGroupMessages, newGroupMessages } = useContext(RelayPoolContext) const { relayPool, lastEventId, lastConfirmationtId, sendEvent, setNewGroupMessages, newGroupMessages } = useContext(RelayPoolContext)
const bottomSheetSearchRef = React.useRef<RBSheet>(null) const bottomSheetSearchRef = React.useRef<RBSheet>(null)
const bottomSheetCreateRef = React.useRef<RBSheet>(null) const bottomSheetCreateRef = React.useRef<RBSheet>(null)
@ -297,15 +297,17 @@ export const GroupsFeed: React.FC = () => {
horizontal={false} horizontal={false}
estimatedItemSize={76} estimatedItemSize={76}
/> />
<AnimatedFAB {privateKey && online && (
style={[styles.fab, { top: Dimensions.get('window').height - 191 }]} <AnimatedFAB
icon='plus' style={[styles.fab, { top: Dimensions.get('window').height - 191 }]}
label='Label' icon='plus'
onPress={() => bottomSheetFabActionRef.current?.open()} label='Label'
animateFrom='right' onPress={() => bottomSheetFabActionRef.current?.open()}
iconMode='static' animateFrom='right'
extended={false} iconMode='static'
/> extended={false}
/>
)}
<RBSheet ref={bottomSheetCreateRef} closeOnDragDown={true} customStyles={bottomSheetStyles}> <RBSheet ref={bottomSheetCreateRef} closeOnDragDown={true} customStyles={bottomSheetStyles}>
<View> <View>
<Text style={styles.input} variant='titleLarge'> <Text style={styles.input} variant='titleLarge'>

View File

@ -9,12 +9,14 @@ import Tabs from '../../../Components/Tabs'
import ZapsFeed from './ZapsFeed' import ZapsFeed from './ZapsFeed'
import BookmarksFeed from './BookmarksFeed' import BookmarksFeed from './BookmarksFeed'
import { RelayPoolContext } from '../../../Contexts/RelayPoolContext' import { RelayPoolContext } from '../../../Contexts/RelayPoolContext'
import { AppContext } from '../../../Contexts/AppContext'
interface HomeFeedProps { interface HomeFeedProps {
navigation: any navigation: any
} }
export const HomeFeed: React.FC<HomeFeedProps> = ({ navigation }) => { export const HomeFeed: React.FC<HomeFeedProps> = ({ navigation }) => {
const { online } = useContext(AppContext)
const { privateKey, publicKey } = useContext(UserContext) const { privateKey, publicKey } = useContext(UserContext)
const { relayPool } = useContext(RelayPoolContext) const { relayPool } = useContext(RelayPoolContext)
const [activeTab, setActiveTab] = React.useState('myFeed') const [activeTab, setActiveTab] = React.useState('myFeed')
@ -80,7 +82,7 @@ export const HomeFeed: React.FC<HomeFeedProps> = ({ navigation }) => {
defaultTab='myFeed' defaultTab='myFeed'
/> />
<View style={styles.feed}>{renderScene[activeTab]}</View> <View style={styles.feed}>{renderScene[activeTab]}</View>
{privateKey && ( {privateKey && online && (
<AnimatedFAB <AnimatedFAB
style={[styles.fab, { top: Dimensions.get('window').height - 191 }]} style={[styles.fab, { top: Dimensions.get('window').height - 191 }]}
icon='pencil-outline' icon='pencil-outline'

View File

@ -143,7 +143,7 @@ export const NotePage: React.FC<NotePageProps> = ({ route }) => {
/> />
</View> </View>
</ScrollView> </ScrollView>
{privateKey && ( {privateKey && online && (
<AnimatedFAB <AnimatedFAB
style={[styles.fabSend, { top: Dimensions.get('window').height - 136 }]} style={[styles.fabSend, { top: Dimensions.get('window').height - 136 }]}
icon='message-plus-outline' icon='message-plus-outline'

View File

@ -18,8 +18,7 @@ interface ProfileCreatePageProps {
export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation }) => { export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation }) => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
const { setPrivateKey, setUserState, publicKey } = useContext(UserContext) const { setPrivateKey, setUserState, publicKey } = useContext(UserContext)
const { createRandomRelays, sendEvent, relays } = useContext(RelayPoolContext) const { createRandomRelays, sendEvent, relays, relayPoolReady } = useContext(RelayPoolContext)
const [key, setKey] = useState<string>()
const [inputValue, setInputValue] = useState<string>() const [inputValue, setInputValue] = useState<string>()
const [keyboardShow, setKeyboardShow] = useState<boolean>(false) const [keyboardShow, setKeyboardShow] = useState<boolean>(false)
const [step, setStep] = useState<number>(0) const [step, setStep] = useState<number>(0)
@ -35,13 +34,16 @@ export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation
generateRandomMnemonic().then((words) => { generateRandomMnemonic().then((words) => {
setMnemonicWords(words) setMnemonicWords(words)
const privateKey = nip06.privateKeyFromSeedWords(Object.values(words).join(' ')) const privateKey = nip06.privateKeyFromSeedWords(Object.values(words).join(' '))
setKey(privateKey) setPrivateKey(privateKey)
const nsec = nip19.nsecEncode(privateKey) const nsec = nip19.nsecEncode(privateKey)
setInputValue(nsec) setInputValue(nsec)
}) })
createRandomRelays()
}, []) }, [])
React.useEffect(() => {
if (relayPoolReady) createRandomRelays()
}, [relayPoolReady])
useEffect(() => { useEffect(() => {
if (inputValue) setLoading(false) if (inputValue) setLoading(false)
}, [inputValue]) }, [inputValue])
@ -92,7 +94,6 @@ export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation
sendEvent(event) sendEvent(event)
} }
if (validConfirmation()) { if (validConfirmation()) {
setPrivateKey(key)
publishRelays() publishRelays()
setUserState('ready') setUserState('ready')
} else { } else {
@ -104,7 +105,6 @@ export const ProfileCreatePage: React.FC<ProfileCreatePageProps> = ({ navigation
} }
const onPressSkip: () => void = () => { const onPressSkip: () => void = () => {
setPrivateKey(key)
publishRelays() publishRelays()
setUserState('ready') setUserState('ready')
} }

View File

@ -1,7 +1,7 @@
import React, { useContext, useState } from 'react' import React, { useContext, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { type ListRenderItem, StyleSheet, View, FlatList } from 'react-native' import { type ListRenderItem, StyleSheet, View, FlatList } from 'react-native'
import { Button, Card, Divider, List, Text, useTheme } from 'react-native-paper' import { ActivityIndicator, Button, Card, Divider, List, Text, useTheme } from 'react-native-paper'
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
import { AppContext } from '../../../Contexts/AppContext' import { AppContext } from '../../../Contexts/AppContext'
import { RelayPoolContext } from '../../../Contexts/RelayPoolContext' import { RelayPoolContext } from '../../../Contexts/RelayPoolContext'
@ -121,6 +121,7 @@ export const ThirdStep: React.FC<ThirdStepProps> = ({ nextStep, skip }) => {
<Card.Content> <Card.Content>
<View style={styles.loadingProfile}> <View style={styles.loadingProfile}>
<Text>{t('profileLoadPage.contatcsRelays')}</Text> <Text>{t('profileLoadPage.contatcsRelays')}</Text>
<ActivityIndicator animating={true} size={20} />
<Text style={{ color: '#7ADC70' }}> <Text style={{ color: '#7ADC70' }}>
{t('profileLoadPage.contatcsRelaysCount', { activeRelays: contactsRelays.length })} {t('profileLoadPage.contatcsRelaysCount', { activeRelays: contactsRelays.length })}
</Text> </Text>

View File

@ -350,27 +350,31 @@ export const RelaysPage: React.FC = () => {
ItemSeparatorComponent={Divider} ItemSeparatorComponent={Divider}
/> />
</ScrollView> </ScrollView>
<AnimatedFAB {online && (
style={styles.fabContacts} <>
icon='cached' <AnimatedFAB
label='push' style={styles.fabContacts}
onPress={() => { icon='cached'
calculateContactsRelays() label='push'
bottomSheetContactsRef.current?.open() onPress={() => {
}} calculateContactsRelays()
animateFrom='right' bottomSheetContactsRef.current?.open()
iconMode='static' }}
extended={false} animateFrom='right'
/> iconMode='static'
<AnimatedFAB extended={false}
style={styles.fabPush} />
icon='upload-multiple' <AnimatedFAB
label='push' style={styles.fabPush}
onPress={() => bottomSheetPushRef.current?.open()} icon='upload-multiple'
animateFrom='right' label='push'
iconMode='static' onPress={() => bottomSheetPushRef.current?.open()}
extended={false} animateFrom='right'
/> iconMode='static'
extended={false}
/>
</>
)}
<AnimatedFAB <AnimatedFAB
style={styles.fabAdd} style={styles.fabAdd}
icon='plus' icon='plus'

View File

@ -24,11 +24,11 @@ import { UserContext } from '../../Contexts/UserContext'
import { WalletContext } from '../../Contexts/WalletContext' import { WalletContext } from '../../Contexts/WalletContext'
import { getZaps, type Zap } from '../../Functions/DatabaseFunctions/Zaps' import { getZaps, type Zap } from '../../Functions/DatabaseFunctions/Zaps'
import type WalletAction from '../../lib/Lightning' import type WalletAction from '../../lib/Lightning'
import { navigate } from '../../lib/Navigation' import { navigate, push } from '../../lib/Navigation'
export const WalletPage: React.FC = () => { export const WalletPage: React.FC = () => {
const theme = useTheme() const theme = useTheme()
const { getSatoshiSymbol, database, setDisplayUserDrawer, online } = React.useContext(AppContext) const { getSatoshiSymbol, database, online } = React.useContext(AppContext)
const { publicKey } = React.useContext(UserContext) const { publicKey } = React.useContext(UserContext)
const { relayPool, lastEventId } = React.useContext(RelayPoolContext) const { relayPool, lastEventId } = React.useContext(RelayPoolContext)
const { refreshWallet, updateWallet, type, balance, transactions, invoices, updatedAt } = const { refreshWallet, updateWallet, type, balance, transactions, invoices, updatedAt } =
@ -171,7 +171,7 @@ export const WalletPage: React.FC = () => {
if (zap.zapped_event_id) { if (zap.zapped_event_id) {
navigate('Note', { noteId: zap.zapped_event_id }) navigate('Note', { noteId: zap.zapped_event_id })
} else if (zap.zapper_user_id) { } else if (zap.zapper_user_id) {
setDisplayUserDrawer(zap.zapper_user_id) push('ProfileActions', { userId: zap.zapper_user_id, title: zap.name })
} }
} }
}} }}

View File

@ -18,7 +18,7 @@ import { Kind } from 'nostr-tools'
import { getUsers, type User } from '../../Functions/DatabaseFunctions/Users' import { getUsers, type User } from '../../Functions/DatabaseFunctions/Users'
import LnPreview from '../../Components/LnPreview' import LnPreview from '../../Components/LnPreview'
import { FlatList, type ListRenderItem, ScrollView, StyleSheet, View, Dimensions } from 'react-native' import { FlatList, type ListRenderItem, ScrollView, StyleSheet, View, Dimensions } from 'react-native'
import { goBack } from '../../lib/Navigation' import { goBack, push } from '../../lib/Navigation'
import { getZapTag } from '../../Functions/RelayFunctions/Events' import { getZapTag } from '../../Functions/RelayFunctions/Events'
interface ZapPageProps { interface ZapPageProps {
@ -33,7 +33,7 @@ export const ZapPage: React.FC<ZapPageProps> = ({ route: { params: { note, user
const userId = user?.id ?? note?.pubkey const userId = user?.id ?? note?.pubkey
const zapPubkey = user?.zap_pubkey ?? note?.zap_pubkey const zapPubkey = user?.zap_pubkey ?? note?.zap_pubkey
const zapSplitTags = getZapTag(note) const zapSplitTags = getZapTag(note)
const { getSatoshiSymbol, database, setDisplayUserDrawer, online } = React.useContext(AppContext) const { getSatoshiSymbol, database, online } = React.useContext(AppContext)
const { relayPool, lastEventId } = React.useContext(RelayPoolContext) const { relayPool, lastEventId } = React.useContext(RelayPoolContext)
const { publicKey, privateKey } = React.useContext(UserContext) const { publicKey, privateKey } = React.useContext(UserContext)
const bottomSheetLnPaymentRef = React.useRef<RBSheet>(null) const bottomSheetLnPaymentRef = React.useRef<RBSheet>(null)
@ -135,7 +135,7 @@ export const ZapPage: React.FC<ZapPageProps> = ({ route: { params: { note, user
const zapDescription = item.tags?.find((tag) => tag[0] === 'description') const zapDescription = item.tags?.find((tag) => tag[0] === 'description')
const content = zapDescription ? JSON.parse(zapDescription[1])?.content : undefined const content = zapDescription ? JSON.parse(zapDescription[1])?.content : undefined
return ( return (
<TouchableRipple onPress={() => setDisplayUserDrawer(item.user_id)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: item?.user_id, title: item?.name })}>
<View key={item.id} style={styles.zapperRow}> <View key={item.id} style={styles.zapperRow}>
<View style={styles.zapperData}> <View style={styles.zapperData}>
<ProfileData <ProfileData
@ -171,7 +171,7 @@ export const ZapPage: React.FC<ZapPageProps> = ({ route: { params: { note, user
const totalWeight = zapSplitTags.reduce((acc, tag) => acc + parseInt(tag[3] ?? '0', 10), 0) const totalWeight = zapSplitTags.reduce((acc, tag) => acc + parseInt(tag[3] ?? '0', 10), 0)
const weightedAllocation = allocationTag ? (parseInt(allocationTag[3] ?? '0', 10) * 100) / totalWeight : 0 const weightedAllocation = allocationTag ? (parseInt(allocationTag[3] ?? '0', 10) * 100) / totalWeight : 0
return ( return (
<TouchableRipple onPress={() => setDisplayUserDrawer(item)}> <TouchableRipple onPress={() => push('ProfileActions', { userId: user?.id, title: user?.name })}>
<View key={item} style={styles.zapperRow}> <View key={item} style={styles.zapperRow}>
<View style={styles.zapperData}> <View style={styles.zapperData}>
<ProfileData <ProfileData