Skip to content

Commit

Permalink
Update notif.js
Browse files Browse the repository at this point in the history
Avoid error for undefined passed args
Notification style changed
  • Loading branch information
NicolasVaillant authored Mar 12, 2022
1 parent 6b7c8ac commit 1e1caba
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions notif.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@

const n = new Notification()

// Passing Arguments here
let textVar = args.plainTexts.toString()

n.title = ""
n.subtitle = textVar.split(",")[0]
n.body = textVar.split(",")[1]
n.title = "Emploi du temps 📚"
n.subtitle = ""

// Avoid error for passed args
if(textVar === null || textVar === undefined || textVar === ""){
n.body = "Aucun résultat"
}else{
n.body = textVar.split(",")[1]
}

n.threadIdentifier = "Emploi du temps"

ENT_url = "https://ent.istp-france.com/ENT/Eleve/MonPlanning.aspx";

n.openURL = ENT_url

// Add action when the notification is held : haptic touch (Apple)
n.addAction("Ouvrir l'ENT", ENT_url, false)

n.threadIdentifier = "Notifications"
n.schedule()
Script.complete()
Script.complete()

0 comments on commit 1e1caba

Please sign in to comment.