Skip to content

Commit

Permalink
add seen api
Browse files Browse the repository at this point in the history
change contact add to put
  • Loading branch information
farhoud committed Jan 18, 2023
1 parent 5a809e0 commit a68a5c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/services/core/real/beeCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import 'fastestsmallesttextencoderdecoder';
import { Buffer } from 'buffer';

class ChatAPI implements IChat {
seen(id: string): void {
CoreModule.seen(id)
}

async get(id: ID): Promise<Chat> {
const res = await CoreModule.getChat(id.toString())
Expand Down Expand Up @@ -65,8 +68,8 @@ class ContactAPI implements IContact {
const chat: Contact = base64ToObject(res)
return chat
}
async add(con: Contact): Promise<boolean> {
const res = await CoreModule.addContact(con._id, con.name)
async put(con: Contact): Promise<boolean> {
const res = await CoreModule.putContact(con._id, con.name)
return res
}
async list(skip: number, limit: number): Promise<Contact[]> {
Expand Down
6 changes: 5 additions & 1 deletion app/services/core/real/beeCore.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface IChat {
get(id: ID): Promise<Chat>
list(skip: number, limit: number): Promise<Chat[]>
send(id: ID, msg: Message): Promise<Message>
seen(id: ID): void
}

export interface IPrivateChat {
Expand All @@ -31,7 +32,7 @@ export interface IMessages {

export interface IContact {
get(id: ID): Promise<Contact>
add(con: Contact): Promise<boolean>
put(con: Contact): Promise<boolean>
list(skip: number, limit: number): Promise<Contact[]>
}

Expand Down Expand Up @@ -66,6 +67,9 @@ export interface Chat {
_id: ID,
name: string,
members: ID[]
type: number,
unread: number,
latestText: string
}

export interface Message {
Expand Down

0 comments on commit a68a5c2

Please sign in to comment.