Skip to content

Commit

Permalink
Fixes (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaSat authored Feb 19, 2023
2 parents f3897f8 + 54748d6 commit 9cc485f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 38 deletions.
18 changes: 4 additions & 14 deletions android/app/src/main/java/com/nostros/classes/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -458,26 +458,16 @@ protected void saveUserMeta(SQLiteDatabase database) throws JSONException {
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("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);
}
values.put("zap_pubkey", getZapPubkey(lnurl, ln_address));
values.put("valid_nip05", validateNip05(nip05) ? 1 : 0);
database.update("nostros_users", values, whereClause, whereArgs);
}
}

Expand Down
20 changes: 11 additions & 9 deletions frontend/Components/LnPayment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,17 @@ export const LnPayment: React.FC<LnPaymentProps> = ({ open, setOpen, note, user
>
{t('lnPayment.anonTip')}
</Button>
<Button
style={styles.spacer}
mode='contained'
disabled={loading || monto === ''}
onPress={() => generateInvoice(true)}
loading={loading && isZap}
>
{t('lnPayment.zap')}
</Button>
{zapPubkey && (
<Button
style={styles.spacer}
mode='contained'
disabled={loading || monto === ''}
onPress={() => generateInvoice(true)}
loading={loading && isZap}
>
{t('lnPayment.zap')}
</Button>
)}
<Button mode='outlined' onPress={() => setOpen(false)}>
{t('lnPayment.cancel')}
</Button>
Expand Down
25 changes: 14 additions & 11 deletions frontend/Components/NoteCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,17 +421,20 @@ export const NoteCard: React.FC<NoteCardProps> = ({
{showActionCount && reactionsCount()}
</Button>
</Surface>
{(note?.lnurl || note?.ln_address) && (
<Button
style={styles.action}
icon={() => (
<MaterialCommunityIcons name='lightning-bolt' size={24} color={'#F5D112'} />
)}
onPress={() => setOpenLn(true)}
>
{note.zap_pubkey?.length > 0 ? formatBigNumber(zapsAmount) : ''}
</Button>
)}
<Button
style={styles.action}
disabled={!note?.lnurl && !note?.ln_address}
icon={() => (
<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>
)}
Expand Down
11 changes: 7 additions & 4 deletions frontend/Pages/SendPage/index.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down Expand Up @@ -255,7 +257,8 @@ const styles = StyleSheet.create({
},
contactsList: {
bottom: 0,
height: 200,
maxHeight: 180,
paddingBottom: 16,
},
contactRow: {
paddingLeft: 16,
Expand Down

0 comments on commit 9cc485f

Please sign in to comment.