Skip to content

Commit

Permalink
Update NIP-51 (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaSat committed Nov 19, 2023
2 parents f839a96 + c4697ed commit 7848e72
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions android/app/src/main/java/com/nostros/classes/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ public Database(String absoluteFilesPath) {
try {
instance.execSQL("ALTER TABLE nostros_notifications ADD COLUMN zapper_user_id TEXT;");
} catch (SQLException e) { }
try {
instance.execSQL("UPDATE nostros_lists SET kind=10003 WHERE kind=10001;"); // FIXME Remove after including kind 10003
} catch (SQLException e) { }
}

public boolean saveEvent(JSONObject data, String userPubKey, String relayUrl) throws JSONException {
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/nostros/classes/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public boolean save(SQLiteDatabase database, String userPubKey, String relayUrl)
saveRelayMetadata(database);
} else if (kind.equals("9735")) {
return saveZap(database, userPubKey);
} else if (kind.equals("10000") || kind.equals("10001") || kind.equals("30001")) {
} else if (kind.equals("10000") || kind.equals("10003")) {
saveList(database);
}
} catch (JSONException e) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/Contexts/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const UserContextProvider = ({ children }: UserContextProviderProps): JSX

const reloadBookmarks: () => void = () => {
if (database && publicKey && privateKey) {
getList(database, 10001, publicKey).then((result) => {
getList(database, 10003, publicKey).then((result) => {
if (result) {
const eTags = getETags(result)
setPublicBookmarks(eTags.map((tag) => tag[1]))
Expand Down
8 changes: 4 additions & 4 deletions frontend/Functions/RelayFunctions/Lists/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const addBookmarkList: (
) => void = async (sendEvent, database, privateKey, publicKey, eventId, publicBookmark) => {
if (!eventId || eventId === '') return

const result = await getList(database, 10001, publicKey)
const result = await getList(database, 10003, publicKey)
let tags: string[][] = result?.tags ?? []
let content: string = result?.content ?? ''
if (publicBookmark) {
Expand All @@ -34,7 +34,7 @@ export const addBookmarkList: (
const event: Event = {
content,
created_at: getUnixTime(new Date()),
kind: 10001,
kind: 10003,
pubkey: publicKey,
tags,
}
Expand Down Expand Up @@ -97,7 +97,7 @@ export const removeBookmarkList: (
) => void = async (sendEvent, database, privateKey, publicKey, eventId) => {
if (!eventId || eventId === '') return

const result = await getList(database, 10001, publicKey)
const result = await getList(database, 10003, publicKey)
if (result) {
let content: string = result?.content ?? ''
const tags = result.tags.filter((tag) => tag[1] !== eventId)
Expand All @@ -110,7 +110,7 @@ export const removeBookmarkList: (
const event: Event = {
content,
created_at: getUnixTime(new Date()),
kind: 10001,
kind: 10003,
pubkey: publicKey,
tags,
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/Pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const HomePage: React.FC = () => {
authors: [publicKey],
},
{
kinds: [10001],
kinds: [10003],
limit: 1,
authors: [publicKey],
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/Pages/ProfileLoadPage/SecondStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const SecondStep: React.FC<SecondStepProps> = ({ nextStep, skip }) => {
authors: [publicKey],
},
{
kinds: [10001],
kinds: [10003],
limit: 1,
authors: [publicKey],
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/Pages/ProfilePage/BookmarksFeed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export const BookmarksFeed: React.FC<BookmarksFeedProps> = ({
if (database) {
const filters: RelayFilters[] = [
{
kinds: [10001],
kinds: [10003],
limit: 1,
authors: [publicKey],
},
]
getList(database, 10001, publicKey).then((result) => {
getList(database, 10003, publicKey).then((result) => {
if (result) {
const eTags = getETags(result)
if (eTags.length > 0) {
Expand All @@ -75,7 +75,7 @@ export const BookmarksFeed: React.FC<BookmarksFeedProps> = ({

const loadNotes: () => void = async () => {
if (database) {
const bookmarks = await getList(database, 10001, publicKey)
const bookmarks = await getList(database, 10003, publicKey)
const eTags = getETags(bookmarks).map((tag) => tag[1])
if (eTags.length > 0) {
getNotes(database, { filters: { id: eTags } }).then((results) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/Pages/ProfilePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const ProfilePage: React.FC<ProfilePageProps> = ({ route }) => {
authors: [route.params.pubKey],
},
{
kinds: [10001],
kinds: [10003],
limit: 1,
authors: [route.params.pubKey],
},
Expand Down

0 comments on commit 7848e72

Please sign in to comment.