Lex refactor fixes (#368)
* Fix: handle validation failures correctly in feed-view * Fix: convert the off-spec feed view to lex objects * Fix to fetching all follows during init * Bump @atproto/api@0.2.1 * Fix: properly group together like notifications * 1.12zio/stable
parent
14965d4d97
commit
cc7b2a246e
2
app.json
2
app.json
|
@ -2,7 +2,7 @@
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "bluesky",
|
"name": "bluesky",
|
||||||
"slug": "bluesky",
|
"slug": "bluesky",
|
||||||
"version": "1.11.0",
|
"version": "1.12.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
"userInterfaceStyle": "light",
|
"userInterfaceStyle": "light",
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.11</string>
|
<string>1.12</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bsky.app",
|
"name": "bsky.app",
|
||||||
"version": "1.11.0",
|
"version": "1.12.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "patch-package",
|
"postinstall": "patch-package",
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"e2e:run": "detox test --configuration ios.sim.debug --take-screenshots all"
|
"e2e:run": "detox test --configuration ios.sim.debug --take-screenshots all"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@atproto/api": "0.2.0",
|
"@atproto/api": "0.2.1",
|
||||||
"@bam.tech/react-native-image-resizer": "^3.0.4",
|
"@bam.tech/react-native-image-resizer": "^3.0.4",
|
||||||
"@expo/webpack-config": "^18.0.1",
|
"@expo/webpack-config": "^18.0.1",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
||||||
|
|
|
@ -57,6 +57,7 @@ export class MyFollowsCache {
|
||||||
await this.rootStore.agent.app.bsky.graph.follow.list({
|
await this.rootStore.agent.app.bsky.graph.follow.list({
|
||||||
repo: this.rootStore.me.did,
|
repo: this.rootStore.me.did,
|
||||||
rkeyStart,
|
rkeyStart,
|
||||||
|
reverse: true,
|
||||||
})
|
})
|
||||||
records = records.concat(res.records)
|
records = records.concat(res.records)
|
||||||
rkeyStart = res.cursor
|
rkeyStart = res.cursor
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
AppBskyFeedPost,
|
AppBskyFeedPost,
|
||||||
AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
||||||
RichText,
|
RichText,
|
||||||
|
jsonToLex,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import AwaitLock from 'await-lock'
|
import AwaitLock from 'await-lock'
|
||||||
import {bundleAsync} from 'lib/async/bundle'
|
import {bundleAsync} from 'lib/async/bundle'
|
||||||
|
@ -50,12 +51,16 @@ export class FeedItemModel {
|
||||||
this.postRecord = this.post.record
|
this.postRecord = this.post.record
|
||||||
this.richText = new RichText(this.postRecord, {cleanNewlines: true})
|
this.richText = new RichText(this.postRecord, {cleanNewlines: true})
|
||||||
} else {
|
} else {
|
||||||
|
this.postRecord = 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',
|
||||||
valid.error,
|
valid.error,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this.postRecord = undefined
|
||||||
|
this.richText = undefined
|
||||||
rootStore.log.warn(
|
rootStore.log.warn(
|
||||||
'app.bsky.feed.getTimeline or app.bsky.feed.getAuthorFeed served an unexpected record type',
|
'app.bsky.feed.getTimeline or app.bsky.feed.getAuthorFeed served an unexpected record type',
|
||||||
this.post.record,
|
this.post.record,
|
||||||
|
@ -634,6 +639,6 @@ async function getGoodStuff(
|
||||||
return {
|
return {
|
||||||
success: res.status === 200,
|
success: res.status === 200,
|
||||||
headers: resHeaders,
|
headers: resHeaders,
|
||||||
data: resBody,
|
data: jsonToLex(resBody),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ export class LikesViewModel {
|
||||||
this.hasLoaded = true
|
this.hasLoaded = true
|
||||||
this.error = cleanError(err)
|
this.error = cleanError(err)
|
||||||
if (err) {
|
if (err) {
|
||||||
this.rootStore.log.error('Failed to fetch votes', err)
|
this.rootStore.log.error('Failed to fetch likes', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {RootStoreModel} from './root-store'
|
||||||
import {PostThreadViewModel} from './post-thread-view'
|
import {PostThreadViewModel} from './post-thread-view'
|
||||||
import {cleanError} from 'lib/strings/errors'
|
import {cleanError} from 'lib/strings/errors'
|
||||||
|
|
||||||
const GROUPABLE_REASONS = ['vote', 'repost', 'follow']
|
const GROUPABLE_REASONS = ['like', 'repost', 'follow']
|
||||||
const PAGE_SIZE = 30
|
const PAGE_SIZE = 30
|
||||||
const MS_1HR = 1e3 * 60 * 60
|
const MS_1HR = 1e3 * 60 * 60
|
||||||
const MS_2DAY = MS_1HR * 48
|
const MS_2DAY = MS_1HR * 48
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {ProfileCardWithFollowBtn} from '../profile/ProfileCard'
|
||||||
import {useStores} from 'state/index'
|
import {useStores} from 'state/index'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
|
||||||
export const PostLikedBy = observer(function PostVotedBy({uri}: {uri: string}) {
|
export const PostLikedBy = observer(function ({uri}: {uri: string}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const view = React.useMemo(
|
const view = React.useMemo(
|
||||||
|
@ -17,7 +17,7 @@ export const PostLikedBy = observer(function PostVotedBy({uri}: {uri: string}) {
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
view.loadMore().catch(err => store.log.error('Failed to fetch votes', err))
|
view.loadMore().catch(err => store.log.error('Failed to fetch likes', err))
|
||||||
}, [view, store.log])
|
}, [view, store.log])
|
||||||
|
|
||||||
const onRefresh = () => {
|
const onRefresh = () => {
|
||||||
|
@ -26,7 +26,7 @@ export const PostLikedBy = observer(function PostVotedBy({uri}: {uri: string}) {
|
||||||
const onEndReached = () => {
|
const onEndReached = () => {
|
||||||
view
|
view
|
||||||
.loadMore()
|
.loadMore()
|
||||||
.catch(err => view?.rootStore.log.error('Failed to load more votes', err))
|
.catch(err => view?.rootStore.log.error('Failed to load more likes', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!view.hasLoaded) {
|
if (!view.hasLoaded) {
|
||||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -19,7 +19,7 @@
|
||||||
jsonpointer "^5.0.0"
|
jsonpointer "^5.0.0"
|
||||||
leven "^3.1.0"
|
leven "^3.1.0"
|
||||||
|
|
||||||
"@atproto/api@*", "@atproto/api@0.2.0":
|
"@atproto/api@*":
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.2.0.tgz#4a60f8f1de91105ad93526d69abcf011bbeaa3be"
|
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.2.0.tgz#4a60f8f1de91105ad93526d69abcf011bbeaa3be"
|
||||||
integrity sha512-AntqYOVrMalBJapnNBV0akh/PWcsKdWq8zfuvv8hZW/jwOkJTVPTRFOP2OHJFcfz4WezytX43ml/L2kSG9z4+Q==
|
integrity sha512-AntqYOVrMalBJapnNBV0akh/PWcsKdWq8zfuvv8hZW/jwOkJTVPTRFOP2OHJFcfz4WezytX43ml/L2kSG9z4+Q==
|
||||||
|
@ -30,6 +30,17 @@
|
||||||
tlds "^1.234.0"
|
tlds "^1.234.0"
|
||||||
typed-emitter "^2.1.0"
|
typed-emitter "^2.1.0"
|
||||||
|
|
||||||
|
"@atproto/api@0.2.1":
|
||||||
|
version "0.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.2.1.tgz#034cab5928e1a6b0059e7237f6a82c57daadb264"
|
||||||
|
integrity sha512-ub92BFrHrm/r1En9IedqRc9r9BZy0i7J8mmFZ5EMxRJwdCJeMYB8CdmLfgNXQcsTPswbYF94pyZkrpeQNJWr1A==
|
||||||
|
dependencies:
|
||||||
|
"@atproto/common-web" "*"
|
||||||
|
"@atproto/uri" "*"
|
||||||
|
"@atproto/xrpc" "*"
|
||||||
|
tlds "^1.234.0"
|
||||||
|
typed-emitter "^2.1.0"
|
||||||
|
|
||||||
"@atproto/auth@*":
|
"@atproto/auth@*":
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@atproto/auth/-/auth-0.0.1.tgz#0ae07bfb6e4e86605504a20f0302e448ba3f8b0e"
|
resolved "https://registry.yarnpkg.com/@atproto/auth/-/auth-0.0.1.tgz#0ae07bfb6e4e86605504a20f0302e448ba3f8b0e"
|
||||||
|
|
Loading…
Reference in New Issue