From 228b41a2ac3e35a606ab7e6d5c8b02deb4d6b7ea Mon Sep 17 00:00:00 2001 From: KoalaSat Date: Wed, 28 Dec 2022 12:47:21 +0100 Subject: [PATCH 1/2] Better Landing --- .../main/java/com/nostros/classes/Event.java | 8 +- .../com/nostros/modules/DatabaseModule.java | 3 + .../com/nostros/modules/RelayPoolModule.java | 11 +- frontend/Components/HomePage/index.tsx | 30 ++++- .../Components/LandingPage/Loader/index.tsx | 104 ++++++++++++++++++ .../Components/LandingPage/Logger/index.tsx | 71 ++---------- frontend/Components/LandingPage/index.tsx | 19 +++- frontend/Components/SendPage/index.tsx | 25 +---- frontend/Components/TextBox/index.tsx | 4 +- frontend/Constants/RelayConstants/index.ts | 1 + frontend/Contexts/RelayPoolContext.tsx | 9 ++ .../DatabaseFunctions/Notes/index.ts | 2 +- frontend/Locales/en.json | 14 ++- frontend/Locales/es.json | 14 ++- frontend/Locales/ru.json | 14 ++- 15 files changed, 225 insertions(+), 104 deletions(-) create mode 100644 frontend/Components/LandingPage/Loader/index.tsx diff --git a/android/app/src/main/java/com/nostros/classes/Event.java b/android/app/src/main/java/com/nostros/classes/Event.java index d66a0775..46e5a423 100644 --- a/android/app/src/main/java/com/nostros/classes/Event.java +++ b/android/app/src/main/java/com/nostros/classes/Event.java @@ -4,6 +4,7 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import android.util.Log; import org.json.JSONArray; import org.json.JSONException; @@ -202,7 +203,7 @@ protected void saveDirectMessage(SQLiteDatabase database) throws JSONException { protected void saveUserMeta(SQLiteDatabase database) throws JSONException { JSONObject userContent = new JSONObject(content); - String query = "SELECT * FROM nostros_users WHERE id = ?"; + String query = "SELECT created_at FROM nostros_users WHERE id = ?"; @SuppressLint("Recycle") Cursor cursor = database.rawQuery(query, new String[] {pubkey}); ContentValues values = new ContentValues(); @@ -211,10 +212,11 @@ protected void saveUserMeta(SQLiteDatabase database) throws JSONException { values.put("about", userContent.optString("about")); values.put("lnurl", userContent.optString("lnurl")); values.put("main_relay", userContent.optString("main_relay")); + values.put("created_at", created_at); if (cursor.getCount() == 0) { values.put("id", pubkey); database.insert("nostros_users", null, values); - } else { + } else if (cursor.moveToFirst() && created_at > cursor.getInt(0)) { String whereClause = "id = ?"; String[] whereArgs = new String[] { this.pubkey @@ -233,7 +235,7 @@ protected void savePets(SQLiteDatabase database) throws JSONException { ContentValues values = new ContentValues(); values.put("id", petId); values.put("name", tag.getString(3)); - values.put("contact", true); + values.put("contact", true); database.insert("nostros_users", null, values); } } diff --git a/android/app/src/main/java/com/nostros/modules/DatabaseModule.java b/android/app/src/main/java/com/nostros/modules/DatabaseModule.java index 36434508..31757d89 100644 --- a/android/app/src/main/java/com/nostros/modules/DatabaseModule.java +++ b/android/app/src/main/java/com/nostros/modules/DatabaseModule.java @@ -65,6 +65,9 @@ public class DatabaseModule { try { database.execSQL("ALTER TABLE nostros_users ADD COLUMN lnurl TEXT;"); } catch (SQLException e) { } + try { + database.execSQL("ALTER TABLE nostros_users ADD COLUMN created_at INT DEFAULT 0;"); + } catch (SQLException e) { } } public void saveEvent(JSONObject data, String userPubKey) throws JSONException { diff --git a/android/app/src/main/java/com/nostros/modules/RelayPoolModule.java b/android/app/src/main/java/com/nostros/modules/RelayPoolModule.java index bf860fba..da4b0966 100644 --- a/android/app/src/main/java/com/nostros/modules/RelayPoolModule.java +++ b/android/app/src/main/java/com/nostros/modules/RelayPoolModule.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.util.List; +import java.util.ListIterator; public class RelayPoolModule extends ReactContextBaseJavaModule { protected List relays; @@ -48,13 +49,16 @@ public void add(String url) { @ReactMethod public void remove(String url, Callback callback) { - for (Relay relay : relays) { - if (relay.url.equals(url)) { + ListIterator iterator = relays.listIterator(); + while(iterator.hasNext()){ + Relay relay = iterator.next(); + if(url.equals(relay.url)){ relay.disconnect(); - relays.remove(relay); + iterator.remove(); database.destroyRelay(relay); } } + callback.invoke(); } @@ -64,6 +68,7 @@ public void connect(String pubKey, Callback callback) { relays = database.getRelays(context); if (relays.isEmpty()) { add("wss://relay.damus.io"); + add("wss://nostr-relay.wlvs.space"); } for (Relay relay : relays) { try { diff --git a/frontend/Components/HomePage/index.tsx b/frontend/Components/HomePage/index.tsx index 181e48af..7d56d6b1 100644 --- a/frontend/Components/HomePage/index.tsx +++ b/frontend/Components/HomePage/index.tsx @@ -1,4 +1,4 @@ -import { Card, Layout, Text, useTheme } from '@ui-kitten/components' +import { Button, Card, Layout, Text, useTheme } from '@ui-kitten/components' import React, { useCallback, useContext, useEffect, useState } from 'react' import { t } from 'i18next' import { @@ -46,7 +46,7 @@ export const HomePage: React.FC = () => { const message: RelayFilters = { kinds: [EventKind.textNote, EventKind.recommendServer], - authors: users.map((user) => user.id) + authors: users.map((user) => user.id), } if (lastNote && lastNotes.length > 0 && !past) { @@ -65,7 +65,7 @@ export const HomePage: React.FC = () => { setRefreshing(false) relayPool?.subscribe('main-channel', { kinds: [EventKind.meta], - authors: notes.map((note) => note.pubkey) + authors: notes.map((note) => note.pubkey), }) }) } @@ -132,6 +132,11 @@ export const HomePage: React.FC = () => { height: 32, }, empty: { + height: 128, + justifyContent: 'center', + alignItems: 'center', + }, + noContacts: { height: 64, justifyContent: 'center', alignItems: 'center', @@ -142,12 +147,27 @@ export const HomePage: React.FC = () => { <> {notes.length > 0 ? ( - }> + } + > {notes.map((note) => itemCard(note))} ) : ( - {t('homePage.noContacts')} + + {t('homePage.noContacts')} + + )} diff --git a/frontend/Components/LandingPage/Loader/index.tsx b/frontend/Components/LandingPage/Loader/index.tsx new file mode 100644 index 00000000..5fa759cb --- /dev/null +++ b/frontend/Components/LandingPage/Loader/index.tsx @@ -0,0 +1,104 @@ +import React, { useContext, useEffect, useState } from 'react' +import { Button, Layout, Text, useTheme } from '@ui-kitten/components' +import { StyleSheet } from 'react-native' +import { RelayPoolContext } from '../../../Contexts/RelayPoolContext' +import { EventKind } from '../../../lib/nostr/Events' +import { AppContext } from '../../../Contexts/AppContext' +import { getUser, getUsers, User } from '../../../Functions/DatabaseFunctions/Users' +import Icon from 'react-native-vector-icons/FontAwesome5' +import { useTranslation } from 'react-i18next' + +export const Loader: React.FC = () => { + const { goToPage, loadingDb, database } = useContext(AppContext) + const { publicKey, relayPool, lastEventId, loadingRelayPool } = useContext(RelayPoolContext) + const theme = useTheme() + const { t } = useTranslation('common') + const [profileFound, setProfileFound] = useState(false) + const [contactsCount, setContactsCount] = useState() + + useEffect(() => { + if (!loadingRelayPool && !loadingDb && publicKey) { + relayPool?.subscribe('main-channel', { + kinds: [EventKind.petNames, EventKind.meta, EventKind.directMessage], + authors: [publicKey], + }) + } + }, [loadingRelayPool, publicKey, loadingDb]) + + useEffect(() => { + loadPets() + loadProfile() + }, [lastEventId]) + + const loadPets: () => void = () => { + if (database) { + getUsers(database, { contacts: true }).then((results) => { + setContactsCount(results.length) + if (results && results.length > 0) { + relayPool?.subscribe('main-channel', { + kinds: [EventKind.meta], + authors: results.map((user: User) => user.id), + }) + } + }) + } + } + + const loadProfile: () => void = () => { + if (database && publicKey) { + getUser(publicKey, database).then((result) => { + if (result) { + setProfileFound(true) + } + }) + } + } + + const styles = StyleSheet.create({ + container: { + padding: 32, + }, + text: { + marginVertical: 10, + padding: 32, + alignItems: 'center', + justifyContent: 'center', + }, + action: { + backgroundColor: 'transparent', + marginTop: 12, + }, + }) + + return ( + <> + + {profileFound ? t('loader.profileFound') : t('loader.searchingProfile')} + {`${t('loader.searchingContacts')} ${contactsCount}`} + + + {t('loader.help1')} + {t('loader.help2')} + + + + + + + + + ) +} + +export default Loader diff --git a/frontend/Components/LandingPage/Logger/index.tsx b/frontend/Components/LandingPage/Logger/index.tsx index 46dadac5..e0dadd25 100644 --- a/frontend/Components/LandingPage/Logger/index.tsx +++ b/frontend/Components/LandingPage/Logger/index.tsx @@ -1,71 +1,27 @@ -import React, { useContext, useEffect, useState } from 'react' +import React, { useContext, useState } from 'react' import { Button, Input, Layout, useTheme } from '@ui-kitten/components' import { Clipboard, StyleSheet } from 'react-native' import { RelayPoolContext } from '../../../Contexts/RelayPoolContext' import { useTranslation } from 'react-i18next' -import { EventKind } from '../../../lib/nostr/Events' -import { AppContext } from '../../../Contexts/AppContext' -import SInfo from 'react-native-sensitive-info' import Icon from 'react-native-vector-icons/FontAwesome5' -import { generateRandomKey, getPublickey } from '../../../lib/nostr/Bip' +import { generateRandomKey } from '../../../lib/nostr/Bip' import { showMessage } from 'react-native-flash-message' -import { getUsers, User } from '../../../Functions/DatabaseFunctions/Users' export const Logger: React.FC = () => { - const { goToPage, loadingDb, database } = useContext(AppContext) - const { privateKey, publicKey, relayPool, loadingRelayPool, setPrivateKey, setPublicKey } = - useContext(RelayPoolContext) + const { publicKey, setPrivateKey, setPublicKey } = useContext(RelayPoolContext) const { t } = useTranslation('common') const theme = useTheme() - const [loading, setLoading] = useState(false) - const [status, setStatus] = useState(0) const [isPrivate, setIsPrivate] = useState(true) const [inputValue, setInputValue] = useState('') - useEffect(() => { - if (loading) { - setStatus(1) + const onPress: () => void = () => { + if (inputValue && inputValue !== '') { if (isPrivate) { setPrivateKey(inputValue) - const publicKey: string = getPublickey(inputValue) - setPublicKey(publicKey) - SInfo.setItem('privateKey', inputValue, {}) - SInfo.setItem('publicKey', publicKey, {}) } else { setPublicKey(inputValue) - SInfo.setItem('publicKey', inputValue, {}) } } - }, [loading]) - - useEffect(() => { - if (!loadingRelayPool && !loadingDb && publicKey) { - relayPool?.subscribe('main-channel', { - kinds: [EventKind.petNames, EventKind.meta], - authors: [publicKey], - }) - setTimeout(loadPets, 4000) - } - }, [loadingRelayPool, publicKey, loadingDb]) - - const onPress: () => void = () => { - if (inputValue && inputValue !== '') { - setLoading(true) - } - } - - const loadPets: () => void = () => { - if (database) { - getUsers(database, { contacts: true }).then((results) => { - if (results && results.length > 0) { - relayPool?.subscribe('main-channel', { - kinds: [EventKind.textNote, EventKind.recommendServer, EventKind.meta], - authors: results.map((user: User) => user.id), - }) - } - setTimeout(() => goToPage('home', true), 5000) - }) - } } const randomKeyGenerator: () => JSX.Element = () => { @@ -95,11 +51,6 @@ export const Logger: React.FC = () => { ) } - const statusName: { [status: number]: string } = { - 0: t('landing.connect'), - 1: t('landing.connecting'), - 2: t('landing.ready'), - } const styles = StyleSheet.create({ inputsContainer: { flexDirection: 'row', @@ -130,7 +81,7 @@ export const Logger: React.FC = () => { const label: string = isPrivate ? t('landing.privateKey') : t('landing.publicKey') - return !privateKey || !publicKey || status !== 0 ? ( + return ( <> @@ -139,7 +90,7 @@ export const Logger: React.FC = () => { label={label} onChangeText={setInputValue} value={inputValue} - disabled={loading} + disabled={publicKey !== undefined} accessoryRight={randomKeyGenerator} /> @@ -151,20 +102,18 @@ export const Logger: React.FC = () => { setIsPrivate(!isPrivate) setInputValue('') }} - disabled={loading} + disabled={publicKey !== undefined} accessoryLeft={keyButton} status={isPrivate ? 'warning' : 'default'} /> - - ) : ( - <> ) } diff --git a/frontend/Components/LandingPage/index.tsx b/frontend/Components/LandingPage/index.tsx index bee2b561..14db5298 100644 --- a/frontend/Components/LandingPage/index.tsx +++ b/frontend/Components/LandingPage/index.tsx @@ -1,11 +1,14 @@ -import React from 'react' +import React, { useContext } from 'react' import { Layout, Text, useTheme } from '@ui-kitten/components' import { Linking, StyleSheet, TouchableOpacity } from 'react-native' import Loading from '../Loading' import Logger from './Logger' +import Loader from './Loader' import Icon from 'react-native-vector-icons/FontAwesome5' +import { RelayPoolContext } from '../../Contexts/RelayPoolContext' export const LandingPage: React.FC = () => { + const { publicKey } = useContext(RelayPoolContext) const theme = useTheme() const onPressQuestion: () => void = () => { @@ -37,6 +40,10 @@ export const LandingPage: React.FC = () => { fontFamily: 'SpaceGrotesk-Bold', fontSize: 45, }, + action: { + backgroundColor: 'transparent', + marginTop: 30, + }, }) return ( @@ -50,8 +57,14 @@ export const LandingPage: React.FC = () => { - NOSTROS - + {!publicKey ? ( + <> + NOSTROS + + + ) : ( + + )} ) diff --git a/frontend/Components/SendPage/index.tsx b/frontend/Components/SendPage/index.tsx index 767ded4d..0c06ba0f 100644 --- a/frontend/Components/SendPage/index.tsx +++ b/frontend/Components/SendPage/index.tsx @@ -4,12 +4,11 @@ import { Layout, List, ListItem, - Spinner, Toggle, TopNavigation, useTheme, } from '@ui-kitten/components' -import React, { useContext, useEffect, useRef, useState } from 'react' +import React, { useContext, useRef, useState } from 'react' import { StyleSheet } from 'react-native' import { AppContext } from '../../Contexts/AppContext' import Icon from 'react-native-vector-icons/FontAwesome5' @@ -31,16 +30,11 @@ export const SendPage: React.FC = () => { const scrollViewRef = useRef() const [content, setContent] = useState('') const [contentWarning, setContentWarning] = useState(false) - const [sending, setSending] = useState(false) const [userSuggestions, setUserSuggestions] = useState([]) const [userMentions, setUserMentions] = useState([]) const breadcrump = page.split('%') const eventId = breadcrump[breadcrump.length - 1].split('#')[1] - useEffect(() => { - relayPool?.unsubscribeAll() - }, []) - const styles = StyleSheet.create({ container: { flex: 1, @@ -55,10 +49,6 @@ export const SendPage: React.FC = () => { }, }) - const onPressBack: () => void = () => { - goBack() - } - const onChangeText: (text: string) => void = (text) => { const match = text.match(/@(\S*)$/) if (database && match && match[1].length > 0) { @@ -110,8 +100,7 @@ export const SendPage: React.FC = () => { pubkey: publicKey, tags, } - relayPool?.sendEvent(event) - setSending(true) + relayPool?.sendEvent(event).then(() => goBack()) }) } } @@ -151,7 +140,7 @@ export const SendPage: React.FC = () => { const renderBackAction = (): JSX.Element => ( + diff --git a/frontend/Components/TextBox/index.tsx b/frontend/Components/TextBox/index.tsx index 81eb7948..f3508e1b 100644 --- a/frontend/Components/TextBox/index.tsx +++ b/frontend/Components/TextBox/index.tsx @@ -1,11 +1,12 @@ import React, { useContext, useEffect, useState } from 'react' import ParsedText from 'react-native-parsed-text' -import { Text, useTheme } from '@ui-kitten/components' +import { useTheme } from '@ui-kitten/components' import { Event } from '../../lib/nostr/Events' import { Linking, StyleSheet } from 'react-native' import { AppContext } from '../../Contexts/AppContext' import { getUser } from '../../Functions/DatabaseFunctions/Users' import { formatPubKey } from '../../Functions/RelayFunctions/Users' +import moment from 'moment' interface TextBoxProps { note: Event @@ -44,6 +45,7 @@ export const TextBox: React.FC = ({ note }) => { const pudKey = note.tags[mentionIndex][1] if (database) { getUser(pudKey, database).then((user) => { + setLoadedUsers(moment().unix()) setUserNames((prev) => { if (user?.name) prev[mentionIndex] = `@${user.name}` return prev diff --git a/frontend/Constants/RelayConstants/index.ts b/frontend/Constants/RelayConstants/index.ts index 810baae5..0ab1e2e4 100644 --- a/frontend/Constants/RelayConstants/index.ts +++ b/frontend/Constants/RelayConstants/index.ts @@ -1,4 +1,5 @@ export const defaultRelays = [ + 'wss://nostr-relay.wlvs.space', 'wss://nostr-pub.wellorder.net', 'wss://nostr-relay.wlvs.space', 'wss://nostr.onsats.org', diff --git a/frontend/Contexts/RelayPoolContext.tsx b/frontend/Contexts/RelayPoolContext.tsx index edb40295..0d54f018 100644 --- a/frontend/Contexts/RelayPoolContext.tsx +++ b/frontend/Contexts/RelayPoolContext.tsx @@ -74,6 +74,7 @@ export const RelayPoolContextProvider = ({ useEffect(() => { if (publicKey && publicKey !== '') { + SInfo.setItem('publicKey', publicKey, {}) if (!loadingRelayPool && page !== 'landing') { goToPage('home', true) } else { @@ -82,6 +83,14 @@ export const RelayPoolContextProvider = ({ } }, [publicKey, loadingRelayPool]) + useEffect(() => { + if (privateKey && privateKey !== '') { + SInfo.setItem('privateKey', privateKey, {}) + const publicKey: string = getPublickey(privateKey) + setPublicKey(publicKey) + } + }, [privateKey]) + useEffect(() => { if (!loadingDb) { SInfo.getItem('privateKey', {}).then((privateResult) => { diff --git a/frontend/Functions/DatabaseFunctions/Notes/index.ts b/frontend/Functions/DatabaseFunctions/Notes/index.ts index 005b55ed..d7379646 100644 --- a/frontend/Functions/DatabaseFunctions/Notes/index.ts +++ b/frontend/Functions/DatabaseFunctions/Notes/index.ts @@ -22,7 +22,7 @@ export const getMainNotes: ( nostros_notes.*, nostros_users.name, nostros_users.picture, nostros_users.contact FROM nostros_notes LEFT JOIN nostros_users ON nostros_users.id = nostros_notes.pubkey - WHERE (nostros_users.contact = 1 OR nostros_users.id = '${pubKey}') + WHERE (nostros_users.contact = 1 OR nostros_notes.pubkey = '${pubKey}') AND nostros_notes.main_event_id IS NULL ORDER BY created_at DESC LIMIT ${limit} diff --git a/frontend/Locales/en.json b/frontend/Locales/en.json index b9d4807e..a7924068 100644 --- a/frontend/Locales/en.json +++ b/frontend/Locales/en.json @@ -16,7 +16,8 @@ "homePage": { "search": "Search", "send": "Send", - "noContacts": "You have no contacts yet" + "noContacts": "You have no contacts yet", + "addContacts": "Add contacts" }, "logger": { "randomKeyGenerator": { @@ -33,6 +34,15 @@ "relaysPage": { "title": "Relays" }, + "loader": { + "searchingProfile": "Searching your profile", + "profileFound": "Profile found", + "searchingContacts": "Searching contacts:", + "help1": "Problems loading your data?", + "help2": "Try connecting to other relays.", + "relays": "Relays", + "home": "Go to Home" + }, "notePage": { "reply": "Reply" }, @@ -44,7 +54,7 @@ "privateKey": "Private key", "username": "Username", "picture": "Picture URL", - "lnurl": "LNURL", + "lnurl": "LNURL / Lightning address", "about": "About", "publish": "Publish" }, diff --git a/frontend/Locales/es.json b/frontend/Locales/es.json index 3822fd1e..66d21a83 100644 --- a/frontend/Locales/es.json +++ b/frontend/Locales/es.json @@ -16,7 +16,8 @@ "homePage": { "search": "Buscar", "send": "Enviar", - "noContacts": "Aún no tienes contactos" + "noContacts": "Aún no tienes contactos", + "addContacts": "Añadir contactos" }, "logger": { "randomKeyGenerator": { @@ -36,6 +37,15 @@ "notePage": { "reply": "Responder" }, + "loader": { + "searchingProfile": "Buscando tu perfil", + "profileFound": "Perfil encontrado", + "searchingContacts": "Buscando tus contactos:", + "help1": "¿Tienes problemas encontrando tus datos?", + "help2": "Intenta contectarte a otros Relays.", + "relays": "Relays", + "home": "Ir a Home" + }, "configPage": { "title": "Configuración", "logout": "Borrar claves", @@ -44,7 +54,7 @@ "privateKey": "Clave privada", "username": "Nombre", "picture": "URL de imagen", - "lnurl": "LNURL", + "lnurl": "LNURL / Lightning address", "about": "Descripción", "publish": "Publicar" }, diff --git a/frontend/Locales/ru.json b/frontend/Locales/ru.json index 07abf9bb..f89a54e7 100644 --- a/frontend/Locales/ru.json +++ b/frontend/Locales/ru.json @@ -16,7 +16,8 @@ "homePage": { "search": "Поиск", "send": "Отправить", - "noContacts": "У Вас пока нет контактов" + "noContacts": "У Вас пока нет контактов", + "addContacts": "Añadir contactos" }, "logger": { "randomKeyGenerator": { @@ -36,6 +37,15 @@ "notePage": { "reply": "Ответить" }, + "loader": { + "searchingProfile": "Buscando tu perfil", + "profileFound": "Perfil encontrado", + "searchingContacts": "Buscando tus contactos:", + "help1": "¿Tienes problemas encontrando tus datos?", + "help2": "Intenta contectarte a otros Relays.", + "relays": "Relays", + "home": "Ir a Home" + }, "configPage": { "title": "Настройки", "logout": "Удалить ключи", @@ -44,7 +54,7 @@ "privateKey": "Приватный ключ", "username": "Имя", "picture": "URL изображения", - "lnurl": "LNURL", + "lnurl": "LNURL / Lightning address", "about": "Описание", "publish": "Опубликовать" }, From 12acf1495f5ef8bae6dd4bee0bc54b65e3d20e8c Mon Sep 17 00:00:00 2001 From: KoalaSat Date: Wed, 28 Dec 2022 18:12:28 +0100 Subject: [PATCH 2/2] Fix --- .../src/main/java/com/nostros/classes/Event.java | 3 +-- frontend/Components/ConfigPage/index.tsx | 2 +- frontend/Components/HomePage/index.tsx | 2 +- .../Functions/DatabaseFunctions/Notes/index.ts | 6 +++--- frontend/Locales/ru.json | 16 ++++++++-------- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/android/app/src/main/java/com/nostros/classes/Event.java b/android/app/src/main/java/com/nostros/classes/Event.java index 46e5a423..e981ee0e 100644 --- a/android/app/src/main/java/com/nostros/classes/Event.java +++ b/android/app/src/main/java/com/nostros/classes/Event.java @@ -4,7 +4,6 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.util.Log; import org.json.JSONArray; import org.json.JSONException; @@ -210,7 +209,7 @@ protected void saveUserMeta(SQLiteDatabase database) throws JSONException { values.put("name", userContent.optString("name")); values.put("picture", userContent.optString("picture")); values.put("about", userContent.optString("about")); - values.put("lnurl", userContent.optString("lnurl")); + values.put("lnurl", userContent.optString("lud06")); values.put("main_relay", userContent.optString("main_relay")); values.put("created_at", created_at); if (cursor.getCount() == 0) { diff --git a/frontend/Components/ConfigPage/index.tsx b/frontend/Components/ConfigPage/index.tsx index 28d8aead..437bb2d8 100644 --- a/frontend/Components/ConfigPage/index.tsx +++ b/frontend/Components/ConfigPage/index.tsx @@ -66,7 +66,7 @@ export const ConfigPage: React.FC = () => { name, about, picture, - lnurl, + lud06: lnurl, }), created_at: moment().unix(), kind: EventKind.meta, diff --git a/frontend/Components/HomePage/index.tsx b/frontend/Components/HomePage/index.tsx index 7d56d6b1..a674061a 100644 --- a/frontend/Components/HomePage/index.tsx +++ b/frontend/Components/HomePage/index.tsx @@ -46,7 +46,7 @@ export const HomePage: React.FC = () => { const message: RelayFilters = { kinds: [EventKind.textNote, EventKind.recommendServer], - authors: users.map((user) => user.id), + authors: [...users.map((user) => user.id), publicKey], } if (lastNote && lastNotes.length > 0 && !past) { diff --git a/frontend/Functions/DatabaseFunctions/Notes/index.ts b/frontend/Functions/DatabaseFunctions/Notes/index.ts index d7379646..52f923a4 100644 --- a/frontend/Functions/DatabaseFunctions/Notes/index.ts +++ b/frontend/Functions/DatabaseFunctions/Notes/index.ts @@ -45,10 +45,10 @@ export const getMentionNotes: ( nostros_notes.*, nostros_users.name, nostros_users.picture, nostros_users.contact FROM nostros_notes LEFT JOIN nostros_users ON nostros_users.id = nostros_notes.pubkey - WHERE nostros_notes.reply_event_id IN ( + WHERE (nostros_notes.reply_event_id IN ( SELECT nostros_notes.id FROM nostros_notes WHERE pubkey = '${pubKey}' - ) - OR user_mentioned = 1 + ) OR nostros_notes.user_mentioned = 1) + AND nostros_notes.pubkey != '${pubKey}' ORDER BY created_at DESC LIMIT ${limit} ` diff --git a/frontend/Locales/ru.json b/frontend/Locales/ru.json index f89a54e7..2d465767 100644 --- a/frontend/Locales/ru.json +++ b/frontend/Locales/ru.json @@ -17,7 +17,7 @@ "search": "Поиск", "send": "Отправить", "noContacts": "У Вас пока нет контактов", - "addContacts": "Añadir contactos" + "addContacts": "Добавить контакты" }, "logger": { "randomKeyGenerator": { @@ -38,13 +38,13 @@ "reply": "Ответить" }, "loader": { - "searchingProfile": "Buscando tu perfil", - "profileFound": "Perfil encontrado", - "searchingContacts": "Buscando tus contactos:", - "help1": "¿Tienes problemas encontrando tus datos?", - "help2": "Intenta contectarte a otros Relays.", - "relays": "Relays", - "home": "Ir a Home" + "searchingProfile": "Поиск профиля", + "profileFound": "Профиль найден", + "searchingContacts": "Поиск контактов:", + "help1": "Проблемы с подключением?", + "help2": "Попробуйте подключиться к другим реле.", + "relays": "Реле", + "home": "На главную" }, "configPage": { "title": "Настройки",