This commit is contained in:
KoalaSat 2023-02-19 22:04:18 +00:00 committed by GitHub
commit 9cc485f16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 38 deletions

View File

@ -458,26 +458,16 @@ public class Event {
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0); values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
values.put("zap_pubkey", getZapPubkey(lnurl, ln_address)); values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
values.put("id", pubkey); values.put("id", pubkey);
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
values.put("blocked", 0); values.put("blocked", 0);
database.insert("nostros_users", null, values); database.insert("nostros_users", null, values);
} else if (cursor.moveToFirst()){ } else if (cursor.moveToFirst() && created_at > cursor.getInt(0)){
String whereClause = "id = ?"; String whereClause = "id = ?";
String[] whereArgs = new String[]{ String[] whereArgs = new String[]{
this.pubkey this.pubkey
}; };
if (created_at >= cursor.getInt(0) || values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
cursor.isNull(1) || values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
cursor.getInt(1) == 0) { database.update("nostros_users", values, whereClause, whereArgs);
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
database.update("nostros_users", values, whereClause, whereArgs);
}
if (created_at >= cursor.getInt(0) ||
cursor.isNull(3) ||
cursor.getString(3).equals("")) {
values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
database.update("nostros_users", values, whereClause, whereArgs);
}
} }
} }

View File

@ -245,15 +245,17 @@ export const LnPayment: React.FC<LnPaymentProps> = ({ open, setOpen, note, user
> >
{t('lnPayment.anonTip')} {t('lnPayment.anonTip')}
</Button> </Button>
<Button {zapPubkey && (
style={styles.spacer} <Button
mode='contained' style={styles.spacer}
disabled={loading || monto === ''} mode='contained'
onPress={() => generateInvoice(true)} disabled={loading || monto === ''}
loading={loading && isZap} onPress={() => generateInvoice(true)}
> loading={loading && isZap}
{t('lnPayment.zap')} >
</Button> {t('lnPayment.zap')}
</Button>
)}
<Button mode='outlined' onPress={() => setOpen(false)}> <Button mode='outlined' onPress={() => setOpen(false)}>
{t('lnPayment.cancel')} {t('lnPayment.cancel')}
</Button> </Button>

View File

@ -421,17 +421,20 @@ export const NoteCard: React.FC<NoteCardProps> = ({
{showActionCount && reactionsCount()} {showActionCount && reactionsCount()}
</Button> </Button>
</Surface> </Surface>
{(note?.lnurl || note?.ln_address) && ( <Button
<Button style={styles.action}
style={styles.action} disabled={!note?.lnurl && !note?.ln_address}
icon={() => ( icon={() => (
<MaterialCommunityIcons name='lightning-bolt' size={24} color={'#F5D112'} /> <MaterialCommunityIcons
)} name='lightning-bolt'
onPress={() => setOpenLn(true)} size={24}
> color={!note?.lnurl && !note?.ln_address ? undefined : '#F5D112'}
{note.zap_pubkey?.length > 0 ? formatBigNumber(zapsAmount) : ''} />
</Button> )}
)} onPress={() => setOpenLn(true)}
>
{note.zap_pubkey?.length > 0 ? formatBigNumber(zapsAmount) : ''}
</Button>
{openLn && <LnPayment open={openLn} setOpen={setOpenLn} note={note} />} {openLn && <LnPayment open={openLn} setOpen={setOpenLn} note={note} />}
</Card.Content> </Card.Content>
)} )}

View File

@ -1,5 +1,5 @@
import React, { useContext, useEffect, useState } from 'react' import React, { useContext, useEffect, useState } from 'react'
import { ScrollView, StyleSheet, View } from 'react-native' import { Dimensions, ScrollView, StyleSheet, View } from 'react-native'
import { AppContext } from '../../Contexts/AppContext' import { AppContext } from '../../Contexts/AppContext'
import { Event } from '../../lib/nostr/Events' import { Event } from '../../lib/nostr/Events'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@ -147,7 +147,7 @@ export const SendPage: React.FC<SendPageProps> = ({ route }) => {
return ( return (
<> <>
<View style={[styles.textInputContainer, { paddingBottom: note ? 230 : 10 }]}> <View style={[styles.textInputContainer]}>
{note && ( {note && (
<View style={styles.noteCard}> <View style={styles.noteCard}>
<NoteCard <NoteCard
@ -165,7 +165,9 @@ export const SendPage: React.FC<SendPageProps> = ({ route }) => {
ref={(ref) => ref?.focus()} ref={(ref) => ref?.focus()}
mode='outlined' mode='outlined'
multiline multiline
numberOfLines={30} numberOfLines={
note ? Dimensions.get('window').height / 35 : Dimensions.get('window').height / 25
}
outlineStyle={{ borderColor: 'transparent' }} outlineStyle={{ borderColor: 'transparent' }}
value={content} value={content}
onChangeText={onChangeText} onChangeText={onChangeText}
@ -255,7 +257,8 @@ const styles = StyleSheet.create({
}, },
contactsList: { contactsList: {
bottom: 0, bottom: 0,
height: 200, maxHeight: 180,
paddingBottom: 16,
}, },
contactRow: { contactRow: {
paddingLeft: 16, paddingLeft: 16,