Merge branch 'main' into dependabot/npm_and_yarn/decode-uri-component-0.2.2

This commit is contained in:
KoalaSat 2022-12-24 20:08:27 +00:00 committed by GitHub
commit d37bf50f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 59 additions and 48 deletions

View File

@ -56,7 +56,6 @@ Local setup: https://github.com/KoalaSat/nostros/blob/main/SETUP.md
### Note
- [ ] Autoscroll to reply
- [ ] Mentions https://github.com/nostr-protocol/nips/blob/master/08.md
- [ ] Reactions https://github.com/nostr-protocol/nips/blob/master/25.md
- [ ] Deletion https://github.com/nostr-protocol/nips/blob/master/09.md

View File

@ -51,6 +51,7 @@ public class RelayPoolModule extends ReactContextBaseJavaModule {
for (Relay relay : relays) {
if (relay.url.equals(url)) {
relay.disconnect();
relays.remove(relay);
database.destroyRelay(relay);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -9,8 +9,8 @@ import {
TopNavigation,
useTheme,
} from '@ui-kitten/components'
import React, { useCallback, useContext, useEffect, useState } from 'react'
import { RefreshControl, ScrollView, StyleSheet, Text, TouchableOpacity } from 'react-native'
import React, { useContext, useEffect, useState } from 'react'
import { ScrollView, StyleSheet, Text, TouchableOpacity } from 'react-native'
import { AppContext } from '../../Contexts/AppContext'
import Icon from 'react-native-vector-icons/FontAwesome5'
import { EventKind } from '../../lib/nostr/Events'
@ -25,7 +25,6 @@ export const ContactsPage: React.FC = () => {
const { relayPool, publicKey, privateKey, lastEventId } = useContext(RelayPoolContext)
const theme = useTheme()
const [users, setUsers] = useState<User[]>()
const [refreshing, setRefreshing] = useState(true)
const [showAddContact, setShowAddContact] = useState<boolean>(false)
const [contactInput, setContactInput] = useState<string>()
const [selectedTab, setSelectedTab] = useState(0)
@ -60,7 +59,6 @@ export const ContactsPage: React.FC = () => {
})
}
}
setRefreshing(false)
})
}
}
@ -97,11 +95,6 @@ export const ContactsPage: React.FC = () => {
goBack()
}
const onRefresh = useCallback(() => {
setRefreshing(true)
subscribeContacts()
}, [])
const renderBackAction = (): JSX.Element => {
return (
<Button
@ -154,10 +147,7 @@ export const ContactsPage: React.FC = () => {
<Tab title={<Text>{t('contactsPage.followers')}</Text>} />
</TabBar>
<Layout style={styles.container} level='3'>
<ScrollView
horizontal={false}
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}
>
<ScrollView horizontal={false}>
{users?.map((user) => (
<UserCard user={user} key={user.id} />
))}

View File

@ -39,7 +39,7 @@ export const HomePage: React.FC = () => {
const subscribeNotes: (users: User[], past?: boolean) => void = async (users, past) => {
if (!database || !publicKey || users.length === 0) return
const lastNotes: Note[] = await getMainNotes(database, publicKey, 1)
const lastNotes: Note[] = await getMainNotes(database, publicKey, initialPageSize)
const lastNote: Note = lastNotes[0]
const message: RelayFilters = {
@ -47,7 +47,7 @@ export const HomePage: React.FC = () => {
authors: users.map((user) => user.id),
}
if (lastNote) {
if (lastNote && lastNotes.length >= initialPageSize) {
message.since = lastNote.created_at
} else {
message.limit = pageSize

View File

@ -9,9 +9,10 @@ import SInfo from 'react-native-sensitive-info'
import Icon from 'react-native-vector-icons/FontAwesome5'
import { generateRandomKey, getPublickey } 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 } = useContext(AppContext)
const { goToPage, loadingDb, database } = useContext(AppContext)
const { privateKey, publicKey, relayPool, loadingRelayPool, setPrivateKey, setPublicKey } =
useContext(RelayPoolContext)
const { t } = useTranslation('common')
@ -44,10 +45,24 @@ export const Logger: React.FC = () => {
kinds: [EventKind.petNames, EventKind.meta],
authors: [publicKey],
})
setTimeout(() => goToPage('home', true), 7000)
setTimeout(loadPets, 4000)
}
}, [loadingRelayPool, publicKey, loadingDb])
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 = () => {
if (!isPrivate) return <></>

View File

@ -13,6 +13,7 @@ import ConfigPage from '../ConfigPage'
import RelaysPage from '../RelaysPage'
import DirectMessagesPage from '../DirectMessagesPage'
import ConversationPage from '../ConversationPage'
import Loading from '../Loading'
export const MainLayout: React.FC = () => {
const { page } = useContext(AppContext)
@ -24,6 +25,7 @@ export const MainLayout: React.FC = () => {
})
const pagination: { [pageName: string]: JSX.Element } = {
'': <Loading />,
landing: <LandingPage />,
home: <HomePage />,
send: <SendPage />,

View File

@ -29,6 +29,10 @@ export const simpleExecute: (
}
export const dropTables: (db: QuickSQLiteConnection) => Promise<BatchQueryResult> = async (db) => {
const dropQueries: Array<[string, [any[] | any[][]]]> = [['DELETE FROM nostros_users;', [[]]]]
const dropQueries: Array<[string, [any[] | any[][]]]> = [
['DELETE FROM nostros_users;', [[]]],
['DELETE FROM nostros_notes;', [[]]],
['DELETE FROM nostros_direct_messages;', [[]]],
]
return db.executeBatch(dropQueries)
}

View File

@ -3,11 +3,11 @@
"landing": {
"connect": "Connect",
"connecting": "Connecting",
"loadingContacts": "Loading Contacts",
"loadingEvents": "Loading Events",
"loadingContacts": "Loading contacts",
"loadingEvents": "Loading events",
"ready": "Ready",
"privateKey": "Private Key",
"publicKey": "Public Key"
"privateKey": "Private key",
"publicKey": "Public key"
},
"navigationBar": {
"home": "Home",
@ -37,25 +37,25 @@
},
"configPage": {
"title": "Configuration",
"logout": "Delete Keys",
"logout": "Delete keys",
"relays": "Relays",
"publicKey": "Public Key",
"privateKey": "Private Key"
"publicKey": "Public key",
"privateKey": "Private key"
},
"direcMessagesPage": {
"sendMessage": {
"placeholder": "Public Key",
"send": "Open Conversation",
"placeholder": "Public key",
"send": "Open conversation",
"contacts": "Contacts"
}
},
"contactsPage": {
"following": "Following",
"followers": "Followers",
"add": "Add User",
"add": "Add user",
"addContact": {
"placeholder": "Public Key",
"add": "Add User"
"placeholder": "Public key",
"add": "Add user"
}
},
"sendPage": {
@ -66,7 +66,7 @@
},
"alerts": {
"relayAdded": "Relay added",
"relayRemoved": "Relay Removed"
"relayRemoved": "Relay removed"
}
}
}

View File

@ -3,11 +3,11 @@
"landing": {
"connect": "Conectar",
"connecting": "Conectando",
"loadingContacts": "Cargando Contactos",
"loadingEvents": "Cargando Eventos",
"loadingContacts": "Cargando contactos",
"loadingEvents": "Cargando eventos",
"ready": "Listo",
"privateKey": "Clave Privada",
"publicKey": "Clave Pública"
"privateKey": "Clave privada",
"publicKey": "Clave pública"
},
"navigationBar": {
"home": "Home",
@ -36,37 +36,37 @@
"reply": "Responder"
},
"configPage": {
"title": "Configuraciónn",
"logout": "Borrar Claves",
"title": "Configuración",
"logout": "Borrar claves",
"relays": "Relays",
"publicKey": "Clave Pública",
"privateKey": "Clave Privada"
"publicKey": "Clave pública",
"privateKey": "Clave privada"
},
"direcMessagesPage": {
"sendMessage": {
"placeholder": "Clave Pública",
"send": "Abrir Conversación",
"placeholder": "Clave pública",
"send": "Abrir conversación",
"contacts": "Contactos"
}
},
"contactsPage": {
"following": "Siguiendo",
"followers": "Seguidores",
"add": "Añadir Usuario",
"add": "Añadir usuario",
"addContact": {
"placeholder": "Clave Pública",
"add": "Añadir Usuario"
"placeholder": "Clave pública",
"add": "Añadir usuario"
}
},
"sendPage": {
"title": "Enviar Nota",
"title": "Enviar nota",
"placeholder": "Di algo al mundo...",
"send": "Enviar",
"reply": "Enviar respuesta"
},
"alerts": {
"relayAdded": "Relay Agregado",
"relayRemoved": "Relay Eliminado"
"relayAdded": "Relay agregado",
"relayRemoved": "Relay eliminado"
}
}
}