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,27 +458,17 @@ public class Event {
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
values.put("id", pubkey);
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
values.put("blocked", 0);
database.insert("nostros_users", null, values);
} else if (cursor.moveToFirst()){
} else if (cursor.moveToFirst() && created_at > cursor.getInt(0)){
String whereClause = "id = ?";
String[] whereArgs = new String[]{
this.pubkey
};
if (created_at >= cursor.getInt(0) ||
cursor.isNull(1) ||
cursor.getInt(1) == 0) {
values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
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);
}
}
}
protected void saveZap(SQLiteDatabase database) throws JSONException {

View File

@ -245,6 +245,7 @@ export const LnPayment: React.FC<LnPaymentProps> = ({ open, setOpen, note, user
>
{t('lnPayment.anonTip')}
</Button>
{zapPubkey && (
<Button
style={styles.spacer}
mode='contained'
@ -254,6 +255,7 @@ export const LnPayment: React.FC<LnPaymentProps> = ({ open, setOpen, note, user
>
{t('lnPayment.zap')}
</Button>
)}
<Button mode='outlined' onPress={() => setOpen(false)}>
{t('lnPayment.cancel')}
</Button>

View File

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

View File

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