Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/notifications-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/notifications-main.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix"
},
"dependencies": {
"@nextcloud/auth": "^2.0.0",
"@nextcloud/axios": "^2.0.0",
"@nextcloud/browser-storage": "^0.1.1",
"@nextcloud/capabilities": "^1.0.4",
Expand Down
11 changes: 10 additions & 1 deletion src/NotificationsApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ import Notification from './Components/Notification.vue'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import Close from 'vue-material-design-icons/Close.vue'
import axios from '@nextcloud/axios'
import { getCurrentUser } from '@nextcloud/auth'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
Expand Down Expand Up @@ -233,20 +234,28 @@ export default {
this.hasNotifyPush = true
}

// Setup the background checker
// Set up the background checker
this._setPollingInterval(this.pollIntervalBase)

this._watchTabVisibility()
subscribe('networkOffline', this.handleNetworkOffline)
subscribe('networkOnline', this.handleNetworkOnline)
subscribe('user_status:status.updated', this.userStatusUpdated)
},

beforeDestroy() {
unsubscribe('user_status:status.updated', this.userStatusUpdated)
unsubscribe('networkOffline', this.handleNetworkOffline)
unsubscribe('networkOnline', this.handleNetworkOnline)
},

methods: {
userStatusUpdated(state) {
if (getCurrentUser().uid === state.userId) {
this.userStatus = state.status
}
},

onOpen() {
this.focusFirstFocusable()
this.requestWebNotificationPermissions()
Expand Down