You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
13 KiB
2 lines
13 KiB
4 weeks ago
|
var w=Object.defineProperty;var y=(n,t,o)=>t in n?w(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var f=(n,t,o)=>y(n,typeof t!="symbol"?t+"":t,o);import{V as v,e as x,M as S,C as k,_ as C,g as h,h as N,i as l,j as e,k as r,H as g,w as q,F as P,x as I}from"./index-BLqts8WY.js";import{Q as T}from"./QuickNav-DgCyvgDx.js";import{au as O,a as A}from"./index-MyY_xqVN.js";import{P as M}from"./PushNotificationPermission-9Wf_h46a.js";import"./index-CsfPLOYu.js";var W=Object.defineProperty,$=Object.getOwnPropertyDescriptor,D=(n,t,o,s)=>{for(var i=s>1?void 0:s?$(t,o):t,d=n.length-1,u;d>=0;d--)(u=n[d])&&(i=(s?u(t,o,i):u(i))||i);return s&&i&&W(t,o,i),i};let m=class extends v{constructor(){super(...arguments);f(this,"$notify");f(this,"subscriptionJSON")}async mounted(){var o;try{const s=await((o=navigator.serviceWorker)==null?void 0:o.ready),i=await(s==null?void 0:s.pushManager.getSubscription());this.subscriptionJSON=i==null?void 0:i.toJSON()}catch(s){console.error("Mount error:",s)}}alertWebPushSubscription(){console.log("Web push subscription:",JSON.parse(JSON.stringify(this.subscriptionJSON))),alert(JSON.stringify(this.subscriptionJSON))}async sendTestWebPushMessage(o=!1){if(!this.subscriptionJSON){this.$notify({group:"alert",type:"danger",title:"Not Subscribed",text:"You must enable notifications before testing the web push."},-1);return}try{await O(this.subscriptionJSON,o),this.$notify({group:"alert",type:"success",title:"Test Web Push Sent",text:"Check your device for the test web push message"+(o?".":" if there are new items in your feed.")},-1)}catch(s){console.error("Got an error sending test notification:",s),this.$notify({group:"alert",type:"danger",title:"Error Sending Test",text:"Got an error sending the test web push notification."},-1)}}showTestNotification(){var s;const o="It Worked";(s=navigator.serviceWorker)==null||s.ready.then(i=>i.showNotification(o,{body:"This is your test notification."})).then(()=>{this.$notify({group:"alert",type:"success",title:"Sent",text:`A notification was triggered, so one should show on your device entitled '${o}'.`},5e3)}).catch(i=>{console.error("Got a notification error:",i),this.$notify({group:"alert",type:"danger",title:"Failed",text:"Got an error sending a notification."},-1)})}showNotificationChoice(){this.$refs.pushNotificationPermission.open(A,async(o,s,i)=>{o&&(await x.settings.update(S,{notifyingReminderMessage:i,notifyingReminderTime:s}),this.notifyingReminder=!0,this.notifyingReminderMessage=i||"",this.notifyingReminderTime=s)})}};m=D([k({components:{PushNotificationPermission:M,QuickNav:T}})],m);const R=""+new URL("chrome-install-pwa-DuUggvhZ.png",import.meta.url).href,F=""+new URL("mac-installed-app-settings-B9fFiuKk.png",import.meta.url).href,V=""+new URL("windows-system-enable-notifications-Dpjdl83C.png",import.meta.url).href,H={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},J={class:"mb-8"},E={class:"text-lg text-center font-light relative px-7"},G={href:"https://developer.mozilla.org/en-US/docs/Web/API/Push_API#browser_compatibility",class:"text-blue-500",target:"_blank"},U={class:"px-2"},B={href:"https://developer.mozilla.org/en-US/docs/Web/API/Push_API#browser_compatibility",class:"text-blue-500",target:"_blank"};function Y(n,t,o,s,i,d){const u=h("QuickNav"),p=h("fa"),b=h("PushNotificationPermission"),c=h("router-link");return I(),N(P,null,[l(u),e("section",H,[e("div",J,[e("div",E,[e("h1",{class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1",onClick:t[0]||(t[0]=a=>n.$router.back())},[l(p,{icon:"chevron-left",class:"fa-fw"})])]),t[8]||(t[8]=e("h1",{id:"ViewHeading",class:"text-4xl text-center font-light pt-4 mb-8"}," Notification Help ",-1))]),e("div",null,[t[27]||(t[27]=e("p",null,"Here are ways to test notifications and get them working.",-1)),t[28]||(t[28]=e("h2",{class:"text-xl font-semibold mt-4"},"Full Test",-1)),e("div",null,[e("p",null,[t[9]||(t[9]=r(" If this works then you're all set. ")),e("button",{onClick:t[1]||(t[1]=a=>n.sendTestWebPushMessage(!0)),class:"block w-full text-center text-md bg-gradient-to-b from-slate-400 to-
|