Skip to content

User: Use push functionality in webbrowsers - refs #3255 #6421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

christianbeeznest
Copy link
Contributor

No description provided.

import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js"
import axios from "axios"

export function usePushSubscription() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function usePushSubscription has 187 lines of code (exceeds 25 allowed). Consider refactoring.

return true
} catch (e) {
console.error("Push subscription error:", e)
return false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this function.

}
}

async function checkSubscription(userId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function checkSubscription has 57 lines of code (exceeds 25 allowed). Consider refactoring.

}
}

async function unsubscribe(userId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function unsubscribe has 33 lines of code (exceeds 25 allowed). Consider refactoring.

}
}

async function subscribe(userId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function subscribe has 48 lines of code (exceeds 25 allowed). Consider refactoring.

import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js"
import axios from "axios"

export function usePushSubscription() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function usePushSubscription has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.

loading.value = true

try {
if (!userId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

return false
}

if (!("serviceWorker" in navigator) || !("PushManager" in window)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

}
}

async function checkSubscription(userId) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function checkSubscription has 64 lines of code (exceeds 25 allowed). Consider refactoring.

import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js"
import axios from "axios"

export function usePushSubscription() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function usePushSubscription has 194 lines of code (exceeds 25 allowed). Consider refactoring.

import { arrayBufferToBase64, urlBase64ToUint8Array } from "../utils/pushUtils.js"
import axios from "axios"

export function usePushSubscription() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function usePushSubscription has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.

Copy link

codeclimate bot commented Jul 5, 2025

Code Climate has analyzed commit 5e5250c and detected 10 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 6
Duplication 4

View more on Code Climate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant