A couple various fixes (#242)

* Fix: set the status bar color for dark mode when logging in

* Add some logging

* Improve read/unread tracking behaviors in notifications
zio/stable
Paul Frazee 2023-03-01 16:54:50 -06:00 committed by GitHub
parent 1fd2942b9b
commit 9b46b2e6a9
4 changed files with 15 additions and 3 deletions

View File

@ -405,6 +405,9 @@ export class NotificationsViewModel {
try {
this.unreadCount = 0
this.rootStore.emitUnreadNotifications(0)
for (const notif of this.notifications) {
notif.isRead = true
}
await this.rootStore.api.app.bsky.notification.updateSeen({
seenAt: new Date().toISOString(),
})

View File

@ -46,10 +46,14 @@ export class RootStoreModel {
hackUpgradeNeeded = false
async hackCheckIfUpgradeNeeded() {
try {
this.log.debug('hackCheckIfUpgradeNeeded()')
const res = await fetch('https://bsky.social/xrpc/app.bsky.feed.getLikes')
await res.text()
runInAction(() => {
this.hackUpgradeNeeded = res.status !== 501
this.log.debug(
`hackCheckIfUpgradeNeeded() said ${this.hackUpgradeNeeded}`,
)
})
} catch (e) {
this.log.error('Failed to hackCheckIfUpgradeNeeded', {e})

View File

@ -61,13 +61,13 @@ export const Notifications = ({navIdx, visible}: ScreenParams) => {
// =
useEffect(() => {
if (!visible) {
// mark read when the user leaves the screen
store.me.notifications.markAllRead()
return
}
store.log.debug('NotificationsScreen: Updating feed')
const softResetSub = store.onScreenSoftReset(scrollToTop)
store.me.notifications.update().then(() => {
store.me.notifications.markAllRead()
})
store.me.notifications.update()
screen('Notifications')
store.nav.setTitle(navIdx, 'Notifications')
return () => {

View File

@ -398,6 +398,11 @@ export const MobileShell: React.FC = observer(() => {
if (!store.session.hasSession) {
return (
<View style={styles.outerContainer}>
<StatusBar
barStyle={
theme.colorScheme === 'dark' ? 'light-content' : 'dark-content'
}
/>
<Login />
<ModalsContainer />
</View>