Fix immediate TS errors
parent
5fd41ad5a2
commit
df0dcf32f9
|
@ -178,10 +178,9 @@ export async function post(store: RootStoreModel, opts: PostOpts) {
|
||||||
) {
|
) {
|
||||||
encoding = 'image/jpeg'
|
encoding = 'image/jpeg'
|
||||||
} else {
|
} else {
|
||||||
store.log.warn(
|
store.log.warn('Unexpected image format for thumbnail, skipping', {
|
||||||
'Unexpected image format for thumbnail, skipping',
|
thumbnail: opts.extLink.localThumb.path,
|
||||||
opts.extLink.localThumb.path,
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (encoding) {
|
if (encoding) {
|
||||||
const thumbUploadRes = await uploadBlob(
|
const thumbUploadRes = await uploadBlob(
|
||||||
|
|
|
@ -34,18 +34,18 @@ export function useOTAUpdate() {
|
||||||
// show a popup modal
|
// show a popup modal
|
||||||
showUpdatePopup()
|
showUpdatePopup()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('useOTAUpdate: Error while checking for update', e)
|
store.log.error('useOTAUpdate: Error while checking for update', {
|
||||||
store.log.error('useOTAUpdate: Error while checking for update', e)
|
error: e,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}, [showUpdatePopup, store.log])
|
}, [showUpdatePopup, store.log])
|
||||||
const updateEventListener = useCallback(
|
const updateEventListener = useCallback(
|
||||||
(event: Updates.UpdateEvent) => {
|
(event: Updates.UpdateEvent) => {
|
||||||
store.log.debug('useOTAUpdate: Listening for update...')
|
store.log.debug('useOTAUpdate: Listening for update...')
|
||||||
if (event.type === Updates.UpdateEventType.ERROR) {
|
if (event.type === Updates.UpdateEventType.ERROR) {
|
||||||
store.log.error(
|
store.log.error('useOTAUpdate: Error while listening for update', {
|
||||||
'useOTAUpdate: Error while listening for update',
|
message: event.message,
|
||||||
event.message,
|
})
|
||||||
)
|
|
||||||
} else if (event.type === Updates.UpdateEventType.NO_UPDATE_AVAILABLE) {
|
} else if (event.type === Updates.UpdateEventType.NO_UPDATE_AVAILABLE) {
|
||||||
// Handle no update available
|
// Handle no update available
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
|
@ -30,18 +30,18 @@ export function init(store: RootStoreModel) {
|
||||||
appId: 'xyz.blueskyweb.app',
|
appId: 'xyz.blueskyweb.app',
|
||||||
})
|
})
|
||||||
store.log.debug('Notifications: Sent push token (init)', {
|
store.log.debug('Notifications: Sent push token (init)', {
|
||||||
type: token.type,
|
tokenType: token.type,
|
||||||
token: token.data,
|
token: token.data,
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
store.log.error('Notifications: Failed to set push token', error)
|
store.log.error('Notifications: Failed to set push token', {error})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// listens for new changes to the push token
|
// listens for new changes to the push token
|
||||||
// In rare situations, a push token may be changed by the push notification service while the app is running. When a token is rolled, the old one becomes invalid and sending notifications to it will fail. A push token listener will let you handle this situation gracefully by registering the new token with your backend right away.
|
// In rare situations, a push token may be changed by the push notification service while the app is running. When a token is rolled, the old one becomes invalid and sending notifications to it will fail. A push token listener will let you handle this situation gracefully by registering the new token with your backend right away.
|
||||||
Notifications.addPushTokenListener(async ({data: t, type}) => {
|
Notifications.addPushTokenListener(async ({data: t, type}) => {
|
||||||
store.log.debug('Notifications: Push token changed', {t, type})
|
store.log.debug('Notifications: Push token changed', {t, tokenType: type})
|
||||||
if (t) {
|
if (t) {
|
||||||
try {
|
try {
|
||||||
await store.agent.api.app.bsky.notification.registerPush({
|
await store.agent.api.app.bsky.notification.registerPush({
|
||||||
|
@ -51,11 +51,11 @@ export function init(store: RootStoreModel) {
|
||||||
appId: 'xyz.blueskyweb.app',
|
appId: 'xyz.blueskyweb.app',
|
||||||
})
|
})
|
||||||
store.log.debug('Notifications: Sent push token (event)', {
|
store.log.debug('Notifications: Sent push token (event)', {
|
||||||
type,
|
tokenType: type,
|
||||||
token: t,
|
token: t,
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
store.log.error('Notifications: Failed to set push token', error)
|
store.log.error('Notifications: Failed to set push token', {error})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -63,7 +63,7 @@ export function init(store: RootStoreModel) {
|
||||||
|
|
||||||
// handle notifications that are received, both in the foreground or background
|
// handle notifications that are received, both in the foreground or background
|
||||||
Notifications.addNotificationReceivedListener(event => {
|
Notifications.addNotificationReceivedListener(event => {
|
||||||
store.log.debug('Notifications: received', event)
|
store.log.debug('Notifications: received', {event})
|
||||||
if (event.request.trigger.type === 'push') {
|
if (event.request.trigger.type === 'push') {
|
||||||
// refresh notifications in the background
|
// refresh notifications in the background
|
||||||
store.me.notifications.syncQueue()
|
store.me.notifications.syncQueue()
|
||||||
|
@ -84,10 +84,9 @@ export function init(store: RootStoreModel) {
|
||||||
// handle notifications that are tapped on
|
// handle notifications that are tapped on
|
||||||
const sub = Notifications.addNotificationResponseReceivedListener(
|
const sub = Notifications.addNotificationResponseReceivedListener(
|
||||||
response => {
|
response => {
|
||||||
store.log.debug(
|
store.log.debug('Notifications: response received', {
|
||||||
'Notifications: response received',
|
actionIdentifier: response.actionIdentifier,
|
||||||
response.actionIdentifier,
|
})
|
||||||
)
|
|
||||||
if (
|
if (
|
||||||
response.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER
|
response.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -134,7 +134,7 @@ export class FeedSourceModel {
|
||||||
try {
|
try {
|
||||||
await this.rootStore.preferences.addSavedFeed(this.uri)
|
await this.rootStore.preferences.addSavedFeed(this.uri)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to save feed', error)
|
this.rootStore.log.error('Failed to save feed', {error})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Save')
|
track('CustomFeed:Save')
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ export class FeedSourceModel {
|
||||||
try {
|
try {
|
||||||
await this.rootStore.preferences.removeSavedFeed(this.uri)
|
await this.rootStore.preferences.removeSavedFeed(this.uri)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to unsave feed', error)
|
this.rootStore.log.error('Failed to unsave feed', {error})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Unsave')
|
track('CustomFeed:Unsave')
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ export class FeedSourceModel {
|
||||||
try {
|
try {
|
||||||
await this.rootStore.preferences.addPinnedFeed(this.uri)
|
await this.rootStore.preferences.addPinnedFeed(this.uri)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to pin feed', error)
|
this.rootStore.log.error('Failed to pin feed', {error})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Pin', {
|
track('CustomFeed:Pin', {
|
||||||
name: this.displayName,
|
name: this.displayName,
|
||||||
|
@ -194,7 +194,7 @@ export class FeedSourceModel {
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
this.likeUri = undefined
|
this.likeUri = undefined
|
||||||
this.likeCount = (this.likeCount || 1) - 1
|
this.likeCount = (this.likeCount || 1) - 1
|
||||||
this.rootStore.log.error('Failed to like feed', e)
|
this.rootStore.log.error('Failed to like feed', {error: e})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Like')
|
track('CustomFeed:Like')
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ export class FeedSourceModel {
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
this.likeUri = uri
|
this.likeUri = uri
|
||||||
this.likeCount = (this.likeCount || 0) + 1
|
this.likeCount = (this.likeCount || 0) + 1
|
||||||
this.rootStore.log.error('Failed to unlike feed', e)
|
this.rootStore.log.error('Failed to unlike feed', {error: e})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Unlike')
|
track('CustomFeed:Unlike')
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ export class ListModel {
|
||||||
try {
|
try {
|
||||||
await this.rootStore.preferences.addPinnedFeed(this.uri)
|
await this.rootStore.preferences.addPinnedFeed(this.uri)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to pin feed', error)
|
this.rootStore.log.error('Failed to pin feed', {error})
|
||||||
} finally {
|
} finally {
|
||||||
track('CustomFeed:Pin', {
|
track('CustomFeed:Pin', {
|
||||||
name: this.data?.name || '',
|
name: this.data?.name || '',
|
||||||
|
@ -455,10 +455,12 @@ export class ListModel {
|
||||||
this.error = cleanError(err)
|
this.error = cleanError(err)
|
||||||
this.loadMoreError = cleanError(loadMoreErr)
|
this.loadMoreError = cleanError(loadMoreErr)
|
||||||
if (err) {
|
if (err) {
|
||||||
this.rootStore.log.error('Failed to fetch user items', err)
|
this.rootStore.log.error('Failed to fetch user items', {error: err})
|
||||||
}
|
}
|
||||||
if (loadMoreErr) {
|
if (loadMoreErr) {
|
||||||
this.rootStore.log.error('Failed to fetch user items', loadMoreErr)
|
this.rootStore.log.error('Failed to fetch user items', {
|
||||||
|
error: loadMoreErr,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ export class NotificationsFeedItemModel {
|
||||||
}
|
}
|
||||||
this.rootStore.log.warn(
|
this.rootStore.log.warn(
|
||||||
'app.bsky.notifications.list served an unsupported record type',
|
'app.bsky.notifications.list served an unsupported record type',
|
||||||
v,
|
{record: v},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,9 @@ export class PostsFeedItemModel {
|
||||||
} else {
|
} else {
|
||||||
this.postRecord = undefined
|
this.postRecord = undefined
|
||||||
this.richText = undefined
|
this.richText = undefined
|
||||||
rootStore.log.warn(
|
rootStore.log.warn('Received an invalid app.bsky.feed.post record', {
|
||||||
'Received an invalid app.bsky.feed.post record',
|
error: valid.error,
|
||||||
valid.error,
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.postRecord = undefined
|
this.postRecord = undefined
|
||||||
|
@ -133,7 +132,7 @@ export class PostsFeedItemModel {
|
||||||
track('Post:Like')
|
track('Post:Like')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to toggle like', error)
|
this.rootStore.log.error('Failed to toggle like', {error})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ export class PostsFeedItemModel {
|
||||||
track('Post:Repost')
|
track('Post:Repost')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to toggle repost', error)
|
this.rootStore.log.error('Failed to toggle repost', {error})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +181,7 @@ export class PostsFeedItemModel {
|
||||||
track('Post:ThreadMute')
|
track('Post:ThreadMute')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to toggle thread mute', error)
|
this.rootStore.log.error('Failed to toggle thread mute', {error})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +190,7 @@ export class PostsFeedItemModel {
|
||||||
await this.rootStore.agent.deletePost(this.post.uri)
|
await this.rootStore.agent.deletePost(this.post.uri)
|
||||||
this.rootStore.emitPostDeleted(this.post.uri)
|
this.rootStore.emitPostDeleted(this.post.uri)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.rootStore.log.error('Failed to delete post', error)
|
this.rootStore.log.error('Failed to delete post', {error})
|
||||||
} finally {
|
} finally {
|
||||||
track('Post:Delete')
|
track('Post:Delete')
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,10 +63,9 @@ export class InvitedUsers {
|
||||||
})
|
})
|
||||||
this.rootStore.me.follows.hydrateMany(this.profiles)
|
this.rootStore.me.follows.hydrateMany(this.profiles)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.rootStore.log.error(
|
this.rootStore.log.error('Failed to fetch profiles for invited users', {
|
||||||
'Failed to fetch profiles for invited users',
|
error: e,
|
||||||
e,
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,13 +110,17 @@ export class MeModel {
|
||||||
await this.fetchProfile()
|
await this.fetchProfile()
|
||||||
this.mainFeed.clear()
|
this.mainFeed.clear()
|
||||||
/* dont await */ this.mainFeed.setup().catch(e => {
|
/* dont await */ this.mainFeed.setup().catch(e => {
|
||||||
this.rootStore.log.error('Failed to setup main feed model', e)
|
this.rootStore.log.error('Failed to setup main feed model', {error: e})
|
||||||
})
|
})
|
||||||
/* dont await */ this.notifications.setup().catch(e => {
|
/* dont await */ this.notifications.setup().catch(e => {
|
||||||
this.rootStore.log.error('Failed to setup notifications model', e)
|
this.rootStore.log.error('Failed to setup notifications model', {
|
||||||
|
error: e,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
/* dont await */ this.notifications.setup().catch(e => {
|
/* dont await */ this.notifications.setup().catch(e => {
|
||||||
this.rootStore.log.error('Failed to setup notifications model', e)
|
this.rootStore.log.error('Failed to setup notifications model', {
|
||||||
|
error: e,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
this.myFeeds.clear()
|
this.myFeeds.clear()
|
||||||
/* dont await */ this.myFeeds.saved.refresh()
|
/* dont await */ this.myFeeds.saved.refresh()
|
||||||
|
@ -184,7 +188,9 @@ export class MeModel {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.rootStore.log.error('Failed to fetch user invite codes', e)
|
this.rootStore.log.error('Failed to fetch user invite codes', {
|
||||||
|
error: e,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
await this.rootStore.invitedUsers.fetch(this.invites)
|
await this.rootStore.invitedUsers.fetch(this.invites)
|
||||||
}
|
}
|
||||||
|
@ -199,7 +205,9 @@ export class MeModel {
|
||||||
this.appPasswords = res.data.passwords
|
this.appPasswords = res.data.passwords
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.rootStore.log.error('Failed to fetch user app passwords', e)
|
this.rootStore.log.error('Failed to fetch user app passwords', {
|
||||||
|
error: e,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +228,7 @@ export class MeModel {
|
||||||
})
|
})
|
||||||
return res.data
|
return res.data
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.rootStore.log.error('Failed to create app password', e)
|
this.rootStore.log.error('Failed to create app password', {error: e})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +243,7 @@ export class MeModel {
|
||||||
this.appPasswords = this.appPasswords.filter(p => p.name !== name)
|
this.appPasswords = this.appPasswords.filter(p => p.name !== name)
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.rootStore.log.error('Failed to delete app password', e)
|
this.rootStore.log.error('Failed to delete app password', {error: e})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ export class ImageModel implements Omit<RNImage, 'size'> {
|
||||||
this.cropped = cropped
|
this.cropped = cropped
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.rootStore.log.error('Failed to crop photo', err)
|
this.rootStore.log.error('Failed to crop photo', {error: err})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ export const ListItems = observer(function ListItemsImpl({
|
||||||
try {
|
try {
|
||||||
await list.refresh()
|
await list.refresh()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
list.rootStore.log.error('Failed to refresh lists', err)
|
list.rootStore.log.error('Failed to refresh lists', {error: err})
|
||||||
}
|
}
|
||||||
setIsRefreshing(false)
|
setIsRefreshing(false)
|
||||||
}, [list, track, setIsRefreshing])
|
}, [list, track, setIsRefreshing])
|
||||||
|
@ -104,7 +104,7 @@ export const ListItems = observer(function ListItemsImpl({
|
||||||
try {
|
try {
|
||||||
await list.loadMore()
|
await list.loadMore()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
list.rootStore.log.error('Failed to load more lists', err)
|
list.rootStore.log.error('Failed to load more lists', {error: err})
|
||||||
}
|
}
|
||||||
}, [list, track])
|
}, [list, track])
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ export const ListsList = observer(function ListsListImpl({
|
||||||
try {
|
try {
|
||||||
await listsList.refresh()
|
await listsList.refresh()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
listsList.rootStore.log.error('Failed to refresh lists', err)
|
listsList.rootStore.log.error('Failed to refresh lists', {error: err})
|
||||||
}
|
}
|
||||||
setIsRefreshing(false)
|
setIsRefreshing(false)
|
||||||
}, [listsList, track, setIsRefreshing])
|
}, [listsList, track, setIsRefreshing])
|
||||||
|
@ -88,7 +88,7 @@ export const ListsList = observer(function ListsListImpl({
|
||||||
try {
|
try {
|
||||||
await listsList.loadMore()
|
await listsList.loadMore()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
listsList.rootStore.log.error('Failed to load more lists', err)
|
listsList.rootStore.log.error('Failed to load more lists', {error: err})
|
||||||
}
|
}
|
||||||
}, [listsList, track])
|
}, [listsList, track])
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,9 @@ export const Feed = observer(function Feed({
|
||||||
setIsPTRing(true)
|
setIsPTRing(true)
|
||||||
await view.refresh()
|
await view.refresh()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
view.rootStore.log.error('Failed to refresh notifications feed', err)
|
view.rootStore.log.error('Failed to refresh notifications feed', {
|
||||||
|
error: err,
|
||||||
|
})
|
||||||
} finally {
|
} finally {
|
||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,9 @@ export const Feed = observer(function Feed({
|
||||||
try {
|
try {
|
||||||
await view.loadMore()
|
await view.loadMore()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
view.rootStore.log.error('Failed to load more notifications', err)
|
view.rootStore.log.error('Failed to load more notifications', {
|
||||||
|
error: err,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}, [view])
|
}, [view])
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ export const PostThread = observer(function PostThread({
|
||||||
try {
|
try {
|
||||||
view?.refresh()
|
view?.refresh()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
view.rootStore.log.error('Failed to refresh posts thread', err)
|
view.rootStore.log.error('Failed to refresh posts thread', {error: err})
|
||||||
}
|
}
|
||||||
setIsRefreshing(false)
|
setIsRefreshing(false)
|
||||||
}, [view, setIsRefreshing])
|
}, [view, setIsRefreshing])
|
||||||
|
|
|
@ -111,13 +111,13 @@ export const PostThreadItem = observer(function PostThreadItem({
|
||||||
const onPressToggleRepost = React.useCallback(() => {
|
const onPressToggleRepost = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
.toggleRepost()
|
.toggleRepost()
|
||||||
.catch(e => store.log.error('Failed to toggle repost', e))
|
.catch(e => store.log.error('Failed to toggle repost', {error: e}))
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
const onPressToggleLike = React.useCallback(() => {
|
const onPressToggleLike = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
.toggleLike()
|
.toggleLike()
|
||||||
.catch(e => store.log.error('Failed to toggle like', e))
|
.catch(e => store.log.error('Failed to toggle like', {error: e}))
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
const onCopyPostText = React.useCallback(() => {
|
const onCopyPostText = React.useCallback(() => {
|
||||||
|
@ -138,7 +138,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
||||||
Toast.show('You will now receive notifications for this thread')
|
Toast.show('You will now receive notifications for this thread')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
store.log.error('Failed to toggle thread mute', e)
|
store.log.error('Failed to toggle thread mute', {error: e})
|
||||||
}
|
}
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ export const PostThreadItem = observer(function PostThreadItem({
|
||||||
Toast.show('Post deleted')
|
Toast.show('Post deleted')
|
||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
store.log.error('Failed to delete post', e)
|
store.log.error('Failed to delete post', {error: e})
|
||||||
Toast.show('Failed to delete post, please try again')
|
Toast.show('Failed to delete post, please try again')
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -142,13 +142,13 @@ const PostLoaded = observer(function PostLoadedImpl({
|
||||||
const onPressToggleRepost = React.useCallback(() => {
|
const onPressToggleRepost = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
.toggleRepost()
|
.toggleRepost()
|
||||||
.catch(e => store.log.error('Failed to toggle repost', e))
|
.catch(e => store.log.error('Failed to toggle repost', {error: e}))
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
const onPressToggleLike = React.useCallback(() => {
|
const onPressToggleLike = React.useCallback(() => {
|
||||||
return item
|
return item
|
||||||
.toggleLike()
|
.toggleLike()
|
||||||
.catch(e => store.log.error('Failed to toggle like', e))
|
.catch(e => store.log.error('Failed to toggle like', {error: e}))
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
const onCopyPostText = React.useCallback(() => {
|
const onCopyPostText = React.useCallback(() => {
|
||||||
|
@ -169,7 +169,7 @@ const PostLoaded = observer(function PostLoadedImpl({
|
||||||
Toast.show('You will now receive notifications for this thread')
|
Toast.show('You will now receive notifications for this thread')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
store.log.error('Failed to toggle thread mute', e)
|
store.log.error('Failed to toggle thread mute', {error: e})
|
||||||
}
|
}
|
||||||
}, [item, store])
|
}, [item, store])
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ const PostLoaded = observer(function PostLoadedImpl({
|
||||||
Toast.show('Post deleted')
|
Toast.show('Post deleted')
|
||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
store.log.error('Failed to delete post', e)
|
store.log.error('Failed to delete post', {error: e})
|
||||||
Toast.show('Failed to delete post, please try again')
|
Toast.show('Failed to delete post, please try again')
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -92,7 +92,7 @@ export const Feed = observer(function Feed({
|
||||||
try {
|
try {
|
||||||
await feed.refresh()
|
await feed.refresh()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
feed.rootStore.log.error('Failed to refresh posts feed', err)
|
feed.rootStore.log.error('Failed to refresh posts feed', {error: err})
|
||||||
}
|
}
|
||||||
setIsRefreshing(false)
|
setIsRefreshing(false)
|
||||||
}, [feed, track, setIsRefreshing])
|
}, [feed, track, setIsRefreshing])
|
||||||
|
@ -104,7 +104,7 @@ export const Feed = observer(function Feed({
|
||||||
try {
|
try {
|
||||||
await feed.loadMore()
|
await feed.loadMore()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
feed.rootStore.log.error('Failed to load more posts', err)
|
feed.rootStore.log.error('Failed to load more posts', {error: err})
|
||||||
}
|
}
|
||||||
}, [feed, track])
|
}, [feed, track])
|
||||||
|
|
||||||
|
|
|
@ -94,14 +94,14 @@ export const FeedItem = observer(function FeedItemImpl({
|
||||||
track('FeedItem:PostRepost')
|
track('FeedItem:PostRepost')
|
||||||
return item
|
return item
|
||||||
.toggleRepost()
|
.toggleRepost()
|
||||||
.catch(e => store.log.error('Failed to toggle repost', e))
|
.catch(e => store.log.error('Failed to toggle repost', {error: e}))
|
||||||
}, [track, item, store])
|
}, [track, item, store])
|
||||||
|
|
||||||
const onPressToggleLike = React.useCallback(() => {
|
const onPressToggleLike = React.useCallback(() => {
|
||||||
track('FeedItem:PostLike')
|
track('FeedItem:PostLike')
|
||||||
return item
|
return item
|
||||||
.toggleLike()
|
.toggleLike()
|
||||||
.catch(e => store.log.error('Failed to toggle like', e))
|
.catch(e => store.log.error('Failed to toggle like', {error: e}))
|
||||||
}, [track, item, store])
|
}, [track, item, store])
|
||||||
|
|
||||||
const onCopyPostText = React.useCallback(() => {
|
const onCopyPostText = React.useCallback(() => {
|
||||||
|
@ -123,7 +123,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
||||||
Toast.show('You will now receive notifications for this thread')
|
Toast.show('You will now receive notifications for this thread')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
store.log.error('Failed to toggle thread mute', e)
|
store.log.error('Failed to toggle thread mute', {error: e})
|
||||||
}
|
}
|
||||||
}, [track, item, store])
|
}, [track, item, store])
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ export const FeedItem = observer(function FeedItemImpl({
|
||||||
Toast.show('Post deleted')
|
Toast.show('Post deleted')
|
||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
store.log.error('Failed to delete post', e)
|
store.log.error('Failed to delete post', {error: e})
|
||||||
Toast.show('Failed to delete post, please try again')
|
Toast.show('Failed to delete post, please try again')
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -38,7 +38,7 @@ export const PostThreadScreen = withAuthRequired(
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
if (!view.hasLoaded && !view.isLoading) {
|
if (!view.hasLoaded && !view.isLoading) {
|
||||||
view.setup().catch(err => {
|
view.setup().catch(err => {
|
||||||
store.log.error('Failed to fetch thread', err)
|
store.log.error('Failed to fetch thread', {error: err})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue