This commit is contained in:
KoalaSat 2023-01-17 14:49:20 +00:00 committed by GitHub
commit eaafe18ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 10 deletions

View File

@ -13,6 +13,7 @@ import com.neovisionaries.ws.client.WebSocketFrame;
import com.nostros.modules.DatabaseModule;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
@ -40,6 +41,14 @@ public class Websocket {
}
}
webSocket.sendText(message);
JSONArray jsonArray = null;
try {
jsonArray = new JSONArray(message);
JSONObject data = jsonArray.getJSONObject(2);
database.saveEvent(data, pubKey);
} catch (JSONException e) {
e.printStackTrace();
}
}
public void disconnect() {

View File

@ -61,19 +61,19 @@ export const MenuItems: React.FC = () => {
{nPub && (
<Card style={styles.cardContainer}>
<Card.Content style={styles.cardContent}>
<TouchableRipple onPress={() => navigate('Profile', { pubKey: user?.id })}>
<TouchableRipple onPress={() => navigate('Profile', { pubKey: publicKey })}>
<View style={styles.cardContent}>
<View style={styles.cardAvatar}>
<NostrosAvatar
name={user?.name}
pubKey={user?.id ?? ''}
pubKey={publicKey ?? ''}
src={user?.picture}
lud06={user?.lnurl}
/>
</View>
<View>
<Text variant='titleMedium'>{user?.name}</Text>
<Text>{formatPubKey(user?.id ?? '')}</Text>
<Text>{formatPubKey(publicKey ?? '')}</Text>
</View>
</View>
</TouchableRipple>

View File

@ -105,7 +105,7 @@ export const HomeFeed: React.FC<HomeFeedProps> = ({ jumpTo }) => {
setNotes(notes)
setRefreshing(false)
if (notes.length > 0) {
relayPool?.subscribe('homepage-contacts-meta', [
relayPool?.subscribe('homepage-reactions', [
{
kinds: [EventKind.reaction, EventKind.textNote, EventKind.recommendServer],
'#e': notes.map((note) => note.id ?? ''),

View File

@ -60,7 +60,7 @@ export const NotificationsFeed: React.FC = () => {
const subscribeNotes: () => void = async () => {
if (!database || !publicKey) return
relayPool?.subscribe('mentions-user', [
relayPool?.subscribe('notification-user', [
{
kinds: [EventKind.textNote],
'#p': [publicKey],
@ -80,15 +80,14 @@ export const NotificationsFeed: React.FC = () => {
setNotes(notes)
setRefreshing(false)
if (notes.length > 0) {
const missingDataNotes = notes.map((note) => note.pubkey)
relayPool?.subscribe('mentions-answers', [
relayPool?.subscribe('notification-answers', [
{
kinds: [EventKind.reaction, EventKind.textNote, EventKind.recommendServer],
'#e': notes.map((note) => note.id ?? ''),
},
{
kinds: [EventKind.meta],
authors: missingDataNotes,
authors: notes.filter((note) => note.name !== undefined).map((note) => note.pubkey),
},
])
}
@ -151,7 +150,7 @@ export const NotificationsFeed: React.FC = () => {
</ScrollView>
) : (
<View style={styles.blank}>
<MaterialCommunityIcons name='message-outline' size={64} style={styles.center} />
<MaterialCommunityIcons name='bell-outline' size={64} style={styles.center} />
<Text variant='headlineSmall' style={styles.center}>
{t('notificationsFeed.emptyTitle')}
</Text>

View File

@ -72,7 +72,13 @@ export const ProfileLoadPage: React.FC = () => {
style={styles.snackbar}
visible
onDismiss={() => {}}
action={{ label: t('profileLoadPage.relays') ?? '', onPress: () => navigate('Relays') }}
action={{
label: t('profileLoadPage.relays') ?? '',
onPress: () => {
relayPool?.unsubscribeAll()
navigate('Relays')
},
}}
>
{t('profileLoadPage.relaysDescripion')}
</Snackbar>