This commit is contained in:
Peter Maquiran
2024-09-02 15:27:07 +01:00
parent 1b9b4600ab
commit 167df65628
12 changed files with 91 additions and 36 deletions
@@ -14,7 +14,11 @@ export class BoldLocalRepository extends DexieRepository<BoldTable, BoldTable>
super(chatDatabase.bold, BoldTableSchema)
}
open() {
return chatDatabase.open()
}
listen() {
return from(liveQuery(() => chatDatabase.bold.toArray()))
}
}
}
@@ -20,21 +20,20 @@ export class MessageLocalDataSourceService extends DexieRepository<MessageTable,
super(chatDatabase.message, MessageTableSchema)
this.setAllSenderToFalse();
this.onCreatingHook()
}
private onCreatingHook() {
chatDatabase.message.hook('creating', (primaryKey, obj, transaction) => {
console.log('A new friend is being added:', obj);
this.creatingSubject.next(obj)
console.log('creating', obj)
});
}
// onCreateObservable() {
// return this.creatingSubject.asObservable().pipe(
// filter(e => e?.sender?.wxFullName)
// )
// }
onCreateObservable() {
return this.creatingSubject.asObservable()
}
async setAllSenderToFalse() {
try {