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 notificationszio/stable
parent
1fd2942b9b
commit
9b46b2e6a9
|
@ -405,6 +405,9 @@ export class NotificationsViewModel {
|
||||||
try {
|
try {
|
||||||
this.unreadCount = 0
|
this.unreadCount = 0
|
||||||
this.rootStore.emitUnreadNotifications(0)
|
this.rootStore.emitUnreadNotifications(0)
|
||||||
|
for (const notif of this.notifications) {
|
||||||
|
notif.isRead = true
|
||||||
|
}
|
||||||
await this.rootStore.api.app.bsky.notification.updateSeen({
|
await this.rootStore.api.app.bsky.notification.updateSeen({
|
||||||
seenAt: new Date().toISOString(),
|
seenAt: new Date().toISOString(),
|
||||||
})
|
})
|
||||||
|
|
|
@ -46,10 +46,14 @@ export class RootStoreModel {
|
||||||
hackUpgradeNeeded = false
|
hackUpgradeNeeded = false
|
||||||
async hackCheckIfUpgradeNeeded() {
|
async hackCheckIfUpgradeNeeded() {
|
||||||
try {
|
try {
|
||||||
|
this.log.debug('hackCheckIfUpgradeNeeded()')
|
||||||
const res = await fetch('https://bsky.social/xrpc/app.bsky.feed.getLikes')
|
const res = await fetch('https://bsky.social/xrpc/app.bsky.feed.getLikes')
|
||||||
await res.text()
|
await res.text()
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.hackUpgradeNeeded = res.status !== 501
|
this.hackUpgradeNeeded = res.status !== 501
|
||||||
|
this.log.debug(
|
||||||
|
`hackCheckIfUpgradeNeeded() said ${this.hackUpgradeNeeded}`,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.log.error('Failed to hackCheckIfUpgradeNeeded', {e})
|
this.log.error('Failed to hackCheckIfUpgradeNeeded', {e})
|
||||||
|
|
|
@ -61,13 +61,13 @@ export const Notifications = ({navIdx, visible}: ScreenParams) => {
|
||||||
// =
|
// =
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
// mark read when the user leaves the screen
|
||||||
|
store.me.notifications.markAllRead()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
store.log.debug('NotificationsScreen: Updating feed')
|
store.log.debug('NotificationsScreen: Updating feed')
|
||||||
const softResetSub = store.onScreenSoftReset(scrollToTop)
|
const softResetSub = store.onScreenSoftReset(scrollToTop)
|
||||||
store.me.notifications.update().then(() => {
|
store.me.notifications.update()
|
||||||
store.me.notifications.markAllRead()
|
|
||||||
})
|
|
||||||
screen('Notifications')
|
screen('Notifications')
|
||||||
store.nav.setTitle(navIdx, 'Notifications')
|
store.nav.setTitle(navIdx, 'Notifications')
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
@ -398,6 +398,11 @@ export const MobileShell: React.FC = observer(() => {
|
||||||
if (!store.session.hasSession) {
|
if (!store.session.hasSession) {
|
||||||
return (
|
return (
|
||||||
<View style={styles.outerContainer}>
|
<View style={styles.outerContainer}>
|
||||||
|
<StatusBar
|
||||||
|
barStyle={
|
||||||
|
theme.colorScheme === 'dark' ? 'light-content' : 'dark-content'
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Login />
|
<Login />
|
||||||
<ModalsContainer />
|
<ModalsContainer />
|
||||||
</View>
|
</View>
|
||||||
|
|
Loading…
Reference in New Issue