Handle post deletions by removing from active views (close #37)
This commit is contained in:
parent
ace0e6bfd9
commit
ebc2033d18
7 changed files with 59 additions and 4 deletions
|
|
@ -5,6 +5,7 @@
|
|||
import {makeAutoObservable} from 'mobx'
|
||||
import {sessionClient as AtpApi, SessionServiceClient} from '@atproto/api'
|
||||
import {createContext, useContext} from 'react'
|
||||
import {DeviceEventEmitter, EmitterSubscription} from 'react-native'
|
||||
import {isObj, hasProp} from '../lib/type-guards'
|
||||
import {LogModel} from './log'
|
||||
import {SessionModel} from './session'
|
||||
|
|
@ -102,6 +103,15 @@ export class RootStoreModel {
|
|||
this.nav.clear()
|
||||
this.me.clear()
|
||||
}
|
||||
|
||||
onPostDeleted(handler: (uri: string) => void): EmitterSubscription {
|
||||
return DeviceEventEmitter.addListener('post-deleted', handler)
|
||||
}
|
||||
|
||||
emitPostDeleted(uri: string) {
|
||||
console.log('emit')
|
||||
DeviceEventEmitter.emit('post-deleted', uri)
|
||||
}
|
||||
}
|
||||
|
||||
const throwawayInst = new RootStoreModel(AtpApi.service('http://localhost')) // this will be replaced by the loader, we just need to supply a value at init
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue