{"version":3,"sources":["webpack:///./src/services/fcm.service.ts","webpack:///./src/views/v2/AccountNotifications.vue?62f7","webpack:///./src/views/v2/AccountNotifications.vue?1794","webpack:///./node_modules/primevue/inputswitch/inputswitch.esm.js","webpack:///./src/views/v2/AccountNotifications.vue?7a3e","webpack:///./src/views/v2/AccountNotifications.vue"],"names":["router","useRouter","FcmManager","gotoDetail","id","route","console","log","push","result","FirebaseMessaging","checkPermissions","receive","removeAllListeners","addListener","event","data","notification","obj","defuntoId","this","requestResult","requestPermissions","tokenResult","getToken","token","isSupported","length","events","DataService","getEventSubscriptions","postdata","subscriptions","editEventSubscriptions","_hoisted_1","_createElementVNode","class","_hoisted_2","classs","_hoisted_3","_hoisted_4","for","_hoisted_5","key","_hoisted_6","_hoisted_7","_hoisted_8","render","_ctx","_cache","$props","$setup","$data","$options","_component_ion_back_button","_resolveComponent","_component_ion_buttons","_component_ion_menu_button","_component_ald_logo","_component_ion_title","_component_ion_toolbar","_component_ion_header","_component_ion_loading","_component_InputSwitch","_component_ion_checkbox","_component_ion_text","_component_ion_item","_component_ion_list","_component_ion_button","_component_ion_card_content","_component_ion_card","_component_ion_toast","_component_ion_content","_component_ion_page","_openBlock","_createBlock","default","_withCtx","_createVNode","color","slot","_","isLoading","cssClass","message","lang","Detail","InCaricamento","modelValue","enableNotifications","$event","_createElementBlock","_createTextVNode","_createCommentVNode","_Fragment","_renderList","subscriptionsState","current","entry","eventType","isEnabled","_toDisplayString","eventName","shape","expand","onClick","onSave","isToastOpen","toastMessage","duration","toastColor","position","onDidDismiss","setIsToastOpen","script","name","emits","props","type","trueValue","falseValue","disabled","Boolean","inputId","String","inputClass","inputStyle","inputProps","focused","methods","newValue","checked","$emit","$refs","input","focus","preventDefault","computed","containerClass","ref","role","style","ariaLabelledby","ariaLabel","onFocus","onBlur","styleInject","css","insertAt","document","head","getElementsByTagName","createElement","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","css_248z","defineComponent","components","IonHeader","IonToolbar","IonTitle","IonContent","IonPage","IonText","IonMenuButton","IonBackButton","IonButtons","IonLoading","aldLogo","IonLabel","IonList","IonItem","IonCard","IonCardHeader","IonCardContent","IonCardSubtitle","IonCardTitle","IonButton","IonAvatar","IonIcon","IonModal","InputSwitch","IonToast","Button","IonCheckbox","setup","store","useStore","state","user","auth","undefined","value","setIsLoading","reactive","hasChanges","watch","oldValue","async","retrieveToken","subscribeToTopic","topic","addListners","forEach","i","dispatch","onMounted","filtered","filter","err","Utils","PresentAlertError","__exports__"],"mappings":"sMAIA,MAAMA,EAASC,iBAETC,EAAa,CAEfC,WAAWC,GAEP,MAAMC,EAAQ,qBAAuBD,EACrCE,QAAQC,IAAI,SAAUF,GACtBL,EAAOQ,KAAKH,IAGhB,oBACI,MAAMI,QAAeC,OAAkBC,mBACjB,UAAlBF,EAAOG,gBACDF,OAAkBG,qBAExBH,OAAkBI,YAAY,8BAAgCC,IAC1DT,QAAQC,IAAI,gCAAiC,CAACQ,UAC9C,MAAMC,EAAOD,EAAME,aAAaD,KAChC,GAAIA,EAAK,CAEL,MAAME,EAAWF,EACbE,EAAIC,UACJC,KAAKjB,WAAWe,EAAIC,WAIpBb,QAAQC,IAAI,8BAKxBG,OAAkBI,YAAY,uBAAyBC,IACnDT,QAAQC,IAAI,wBAAyB,CAACQ,cAKlD,sBAEE,MAAMN,QAAeC,OAAkBC,mBACrC,GAAsB,WAAlBF,EAAOG,QACX,CACI,MAAMS,QAAsBX,OAAkBY,qBAC9C,GAA6B,UAAzBD,EAAcT,QAIhB,OAFAN,QAAQC,IAAI,yCAEL,GAIPD,QAAQC,IAAI,8CAA+Cc,EAAcT,SAI/E,MAAMW,QAAoBb,OAAkBc,SAAS,IAErD,OADAlB,QAAQC,IAAI,UAAWgB,EAAYE,OAC5BF,EAAYE,OAIvB,qBAEI,SAAUf,OAAkBgB,cAAc,CAEtC,MAAMjB,QAAeC,OAAkBC,mBACvC,GAAsB,WAAlBF,EAAOG,QAAqB,CAC5B,MAAMW,QAAoBb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,QAAQC,IAAI,yBAA0ByB,EAAcoK,OACpDpG,EAAmBC,QAAUjE,EAAcoK,MAC3C,MAAMe,EAAWnL,EAAcoK,MAAOgB,OAAOJ,GAAIA,EAAE5G,WACnDX,EAAoB2G,MAAQe,GAAYA,EAASxL,OAAS,EAC1D0K,GAAa,GACb,MAAOgB,GACPC,OAAMC,kBAAkB,0BAA2BF,EAAIjI,QAAS,CAC9D,UAKN,MAAMsB,EAASgG,UACb,IACEpM,QAAQC,IAAI,UACZ,MAAMwB,EAAiC,CAAEN,MAAOA,EAAM2K,MAAOpK,cAAgBgE,EAAmBC,eAC1F6F,EAAMmB,SAAS,yBAAyBlL,GAC9C6E,EAAawF,MAAQ,wBACrBtF,EAAWsF,MAAQ,UACnBnF,GAAe,GAEjB,MAAOoG,GACLC,OAAMC,kBAAkB,yCAA0CF,EAAIjI,QAAS,CAC7E,SAKN,MAAO,CACLC,OACAH,YACAyB,cACAM,iBACAoF,eACAJ,OACArF,eACAE,aACAd,qBACAuG,aACA7F,SACAjB,0B,iCCpLN,MAAM+H,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAASzK,KAErD,gB","file":"js/chunk-a5352d82.b916832f.js","sourcesContent":["import { FirebaseMessaging } from '@capacitor-firebase/messaging';\r\nimport { isNavigationFailure, useRouter } from \"vue-router\";\r\nimport { DataService } from '@/services/data.service';\r\n\r\nconst router = useRouter();\r\n \r\nconst FcmManager = {\r\n\r\n gotoDetail(id: number) \r\n {\r\n const route = \"/tabs/tab1/detail/\" + id;\r\n console.log('Go to:', route);\r\n router.push(route);\r\n },\r\n\r\n async addListners(){\r\n const result = await FirebaseMessaging.checkPermissions();\r\n if( result.receive != \"denied\" ){\r\n await FirebaseMessaging.removeAllListeners();\r\n \r\n FirebaseMessaging.addListener('notificationActionPerformed', (event) => {\r\n console.log('notificationActiosnPerformed:', {event});\r\n const data = event.notification.data;\r\n if (data){\r\n //console.log('Payload Data: ', data);\r\n const obj: any = data as any;\r\n if (obj.defuntoId){\r\n this.gotoDetail(obj.defuntoId);\r\n }\r\n else\r\n {\r\n console.log('Payload senza defuntoId');\r\n }\r\n }\r\n });\r\n \r\n FirebaseMessaging.addListener('notificationReceived', (event) => {\r\n console.log('notificationReceived:', {event});\r\n });\r\n }\r\n },\r\n\r\n async retrieveToken(): Promise \r\n {\r\n const result = await FirebaseMessaging.checkPermissions();\r\n if( result.receive != \"granted\")\r\n {\r\n const requestResult = await FirebaseMessaging.requestPermissions();\r\n if (requestResult.receive == \"denied\")\r\n {\r\n console.log(\"Consenso attivazione notifiche negato\");\r\n //enableNotifications.value = false;\r\n return \"\";\r\n }\r\n else\r\n {\r\n console.log(\"Consenso attivazione notifiche consentito: \", requestResult.receive); \r\n }\r\n } \r\n\r\n const tokenResult = await FirebaseMessaging.getToken({});\r\n console.log(\"Token: \", tokenResult.token);\r\n return tokenResult.token;\r\n },\r\n\r\n\r\n async refreshToken() : Promise {\r\n\r\n if (await FirebaseMessaging.isSupported()){\r\n \r\n const result = await FirebaseMessaging.checkPermissions();\r\n if( result.receive == \"granted\"){\r\n const tokenResult = await FirebaseMessaging.getToken();\r\n if (tokenResult && tokenResult.token && tokenResult.token.length > 0)\r\n {\r\n const events = await DataService.getEventSubscriptions();\r\n const postdata = { token: tokenResult.token, subscriptions:events};\r\n await DataService.editEventSubscriptions(postdata);\r\n console.log(\"Refreshed FCM Token: \", tokenResult.token);\r\n } \r\n }\r\n }\r\n else\r\n {\r\n console.log(\"FCM not supported!\") \r\n }\r\n }\r\n\r\n}\r\n\r\nexport { FcmManager }","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../../../node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader-v16/dist/index.js??ref--1-1!./AccountNotifications.vue?vue&type=style&index=0&id=b7927814&lang=css\"","import { resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, createElementVNode as _createElementVNode, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, toDisplayString as _toDisplayString, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = /*#__PURE__*/_createElementVNode(\"p\", { class: \"card-title\" }, \"Gestisci Notifiche\", -1)\nconst _hoisted_2 = /*#__PURE__*/_createElementVNode(\"p\", { classs: \"small\" }, \"Ricevi notifiche push sugli eventi importanti relativi ai tuoi defunti.\", -1)\nconst _hoisted_3 = { class: \"text-center mt-3\" }\nconst _hoisted_4 = /*#__PURE__*/_createElementVNode(\"span\", {\n for: \"switch1\",\n class: \"align-top\"\n}, \" Attiva notifiche\", -1)\nconst _hoisted_5 = {\n key: 0,\n class: \"mt-2\"\n}\nconst _hoisted_6 = /*#__PURE__*/_createElementVNode(\"b\", null, \"seleziona gli eventi a cui sei interessato\", -1)\nconst _hoisted_7 = {\n key: 1,\n class: \"mt-2\"\n}\nconst _hoisted_8 = { class: \"mt-4\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_ion_back_button = _resolveComponent(\"ion-back-button\")!\n const _component_ion_buttons = _resolveComponent(\"ion-buttons\")!\n const _component_ion_menu_button = _resolveComponent(\"ion-menu-button\")!\n const _component_ald_logo = _resolveComponent(\"ald-logo\")!\n const _component_ion_title = _resolveComponent(\"ion-title\")!\n const _component_ion_toolbar = _resolveComponent(\"ion-toolbar\")!\n const _component_ion_header = _resolveComponent(\"ion-header\")!\n const _component_ion_loading = _resolveComponent(\"ion-loading\")!\n const _component_InputSwitch = _resolveComponent(\"InputSwitch\")!\n const _component_ion_checkbox = _resolveComponent(\"ion-checkbox\")!\n const _component_ion_text = _resolveComponent(\"ion-text\")!\n const _component_ion_item = _resolveComponent(\"ion-item\")!\n const _component_ion_list = _resolveComponent(\"ion-list\")!\n const _component_ion_button = _resolveComponent(\"ion-button\")!\n const _component_ion_card_content = _resolveComponent(\"ion-card-content\")!\n const _component_ion_card = _resolveComponent(\"ion-card\")!\n const _component_ion_toast = _resolveComponent(\"ion-toast\")!\n const _component_ion_content = _resolveComponent(\"ion-content\")!\n const _component_ion_page = _resolveComponent(\"ion-page\")!\n\n return (_openBlock(), _createBlock(_component_ion_page, null, {\n default: _withCtx(() => [\n _createVNode(_component_ion_header, { class: \"ion-no-border\" }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_toolbar, { color: \"primary\" }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_buttons, { slot: \"start\" }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_back_button)\n ]),\n _: 1\n }),\n _createVNode(_component_ion_buttons, { slot: \"end\" }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_menu_button)\n ]),\n _: 1\n }),\n _createVNode(_component_ion_title, null, {\n default: _withCtx(() => [\n _createVNode(_component_ald_logo)\n ]),\n _: 1\n })\n ]),\n _: 1\n })\n ]),\n _: 1\n }),\n _createVNode(_component_ion_loading, {\n \"is-open\": _ctx.isLoading,\n cssClass: \"my-custom-class\",\n message: _ctx.lang.Detail.InCaricamento\n }, null, 8, [\"is-open\", \"message\"]),\n _createVNode(_component_ion_content, { class: \"map-backgorund\" }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_card, null, {\n default: _withCtx(() => [\n _createVNode(_component_ion_card_content, null, {\n default: _withCtx(() => [\n _hoisted_1,\n _hoisted_2,\n _createElementVNode(\"div\", _hoisted_3, [\n _createVNode(_component_InputSwitch, {\n id: \"switch1\",\n modelValue: _ctx.enableNotifications,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((_ctx.enableNotifications) = $event))\n }, null, 8, [\"modelValue\"]),\n _hoisted_4\n ]),\n (_ctx.enableNotifications)\n ? (_openBlock(), _createElementBlock(\"p\", _hoisted_5, [\n _createTextVNode(\"Non vogliamo essere invadenti: \"),\n _hoisted_6\n ]))\n : _createCommentVNode(\"\", true),\n (_ctx.enableNotifications)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_7, [\n _createVNode(_component_ion_list, null, {\n default: _withCtx(() => [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.subscriptionsState.current, (entry) => {\n return (_openBlock(), _createBlock(_component_ion_item, {\n key: entry.eventType.id\n }, {\n default: _withCtx(() => [\n _createVNode(_component_ion_checkbox, {\n slot: \"start\",\n \"onUpdate:modelValue\": ($event: any) => (entry.isEnabled = $event),\n modelValue: entry.isEnabled\n }, null, 8, [\"onUpdate:modelValue\", \"modelValue\"]),\n _createVNode(_component_ion_text, null, {\n default: _withCtx(() => [\n _createElementVNode(\"small\", null, _toDisplayString(entry.eventType.eventName), 1)\n ]),\n _: 2\n }, 1024)\n ]),\n _: 2\n }, 1024))\n }), 128))\n ]),\n _: 1\n }),\n _createElementVNode(\"div\", _hoisted_8, [\n _createVNode(_component_ion_button, {\n shape: \"round\",\n color: \"primary\",\n expand: \"block\",\n onClick: _cache[1] || (_cache[1] = ($event: any) => (_ctx.onSave()))\n }, {\n default: _withCtx(() => [\n _createTextVNode(\"Salva\")\n ]),\n _: 1\n })\n ])\n ]))\n : _createCommentVNode(\"\", true)\n ]),\n _: 1\n })\n ]),\n _: 1\n }),\n _createVNode(_component_ion_toast, {\n \"is-open\": _ctx.isToastOpen,\n message: _ctx.toastMessage,\n duration: 3500,\n color: _ctx.toastColor,\n position: \"top\",\n onDidDismiss: _cache[2] || (_cache[2] = ($event: any) => (_ctx.setIsToastOpen(false)))\n }, null, 8, [\"is-open\", \"message\", \"color\"])\n ]),\n _: 1\n })\n ]),\n _: 1\n }))\n}","import { openBlock, createElementBlock, normalizeClass, createElementVNode, mergeProps } from 'vue';\n\nvar script = {\n name: 'InputSwitch',\n emits: ['click', 'update:modelValue', 'change', 'input', 'focus', 'blur'],\n props: {\n modelValue: {\n type: null,\n default: false\n },\n trueValue: {\n type: null,\n default: true\n },\n falseValue: {\n type: null,\n default: false\n },\n disabled: {\n type: Boolean,\n default: false\n },\n inputId: {\n type: String,\n default: null\n },\n inputClass: {\n type: String,\n default: null\n },\n inputStyle: {\n type: null,\n default: null\n },\n inputProps: {\n type: null,\n default: null\n },\n 'aria-labelledby': {\n type: String,\n default: null\n },\n 'aria-label': {\n type: String,\n default: null\n }\n },\n data() {\n return {\n focused: false\n };\n },\n methods: {\n onClick(event) {\n if (!this.disabled) {\n const newValue = this.checked ? this.falseValue : this.trueValue;\n\n this.$emit('click', event);\n this.$emit('update:modelValue', newValue);\n this.$emit('change', event);\n this.$emit('input', newValue);\n this.$refs.input.focus();\n }\n\n event.preventDefault();\n },\n onFocus(event) {\n this.focused = true;\n this.$emit('focus', event);\n },\n onBlur(event) {\n this.focused = false;\n this.$emit('blur', event);\n }\n },\n computed: {\n containerClass() {\n return [\n 'p-inputswitch p-component',\n {\n 'p-inputswitch-checked': this.checked,\n 'p-disabled': this.disabled,\n 'p-focus': this.focused\n }\n ];\n },\n checked() {\n return this.modelValue === this.trueValue;\n }\n }\n};\n\nconst _hoisted_1 = { class: \"p-hidden-accessible\" };\nconst _hoisted_2 = [\"id\", \"checked\", \"disabled\", \"aria-checked\", \"aria-labelledby\", \"aria-label\"];\nconst _hoisted_3 = /*#__PURE__*/createElementVNode(\"span\", { class: \"p-inputswitch-slider\" }, null, -1);\n\nfunction render(_ctx, _cache, $props, $setup, $data, $options) {\n return (openBlock(), createElementBlock(\"div\", {\n class: normalizeClass($options.containerClass),\n onClick: _cache[2] || (_cache[2] = $event => ($options.onClick($event)))\n }, [\n createElementVNode(\"div\", _hoisted_1, [\n createElementVNode(\"input\", mergeProps({\n ref: \"input\",\n id: $props.inputId,\n type: \"checkbox\",\n role: \"switch\",\n class: $props.inputClass,\n style: $props.inputStyle,\n checked: $options.checked,\n disabled: $props.disabled,\n \"aria-checked\": $options.checked,\n \"aria-labelledby\": _ctx.ariaLabelledby,\n \"aria-label\": _ctx.ariaLabel,\n onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),\n onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event)))\n }, $props.inputProps), null, 16, _hoisted_2)\n ]),\n _hoisted_3\n ], 2))\n}\n\nfunction styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar css_248z = \"\\n.p-inputswitch {\\n position: relative;\\n display: inline-block;\\n}\\n.p-inputswitch-slider {\\n position: absolute;\\n cursor: pointer;\\n top: 0;\\n left: 0;\\n right: 0;\\n bottom: 0;\\n}\\n.p-inputswitch-slider:before {\\n position: absolute;\\n content: '';\\n top: 50%;\\n}\\n\";\nstyleInject(css_248z);\n\nscript.render = render;\n\nexport { script as default };\n","\r\nimport {\r\n IonPage,\r\n IonHeader,\r\n IonToolbar,\r\n IonTitle,\r\n IonText,\r\n IonMenuButton,\r\n IonBackButton,\r\n IonButtons,\r\n IonLoading,\r\n IonLabel,\r\n IonList,\r\n IonItem,\r\n IonCard,\r\n IonCardHeader,\r\n IonCardContent,\r\n IonCardSubtitle,\r\n IonCardTitle,\r\n IonButton,\r\n IonAvatar,\r\n IonIcon,\r\n IonModal,\r\n IonContent,\r\n IonToast,\r\n IonCheckbox\r\n} from \"@ionic/vue\";\r\nimport aldLogo from \"@/components/aldilapp/shared/ald-logo.vue\";\r\nimport { useStore, mapActions } from \"vuex\";\r\nimport { key } from \"../../store\";\r\nimport { useRoute, useRouter } from \"vue-router\";\r\nimport Button from \"primevue/button\";\r\nimport InputSwitch from 'primevue/inputswitch';\r\nimport { FirebaseMessaging } from '@capacitor-firebase/messaging';\r\nimport { computed, defineComponent, onMounted, ref, reactive, watch } from \"vue\";\r\n//import { defineCustomElements } from '@stripe-elements/stripe-elements/loader';\r\nimport { EditSubscriptionsDTO } from \"@/models/index\";\r\nimport { StorageService } from \"@/services/storage.service\";\r\nimport Utils from \"@/services/utils.service\";\r\nimport { filter } from \"ionicons/icons\";\r\nimport { FcmManager } from '@/services/fcm.service';\r\nexport default defineComponent({\r\n name: \"TabAccount\",\r\n components: {\r\n IonHeader,\r\n IonToolbar,\r\n IonTitle,\r\n IonContent,\r\n IonPage,\r\n IonText,\r\n IonMenuButton,\r\n IonBackButton,\r\n IonButtons,\r\n IonLoading,\r\n aldLogo,\r\n IonLabel,\r\n IonList,\r\n IonItem,\r\n IonCard,\r\n IonCardHeader,\r\n IonCardContent,\r\n IonCardSubtitle,\r\n IonCardTitle,\r\n IonButton,\r\n IonAvatar,\r\n IonIcon,\r\n IonModal,\r\n InputSwitch,\r\n IonToast,\r\n Button,\r\n IonCheckbox\r\n },\r\n setup() {\r\n const isToastOpen = ref(false);\r\n const isLoading = ref(false);\r\n const isPosting = ref(false);\r\n const store = useStore(key);\r\n const router = useRouter();\r\n const lang = computed(() => store.state.lang);\r\n const user = computed(() => store.state.auth);\r\n const subscriptions = computed(() => store.state.subscriptions);\r\n const toastMessage = ref(\"\");\r\n const toastColor = ref(\"\");\r\n const enableNotifications = ref(undefined);\r\n const setIsToastOpen = (state: boolean) => (isToastOpen.value = state);\r\n const setIsLoading = (state: boolean) => (isLoading.value = state);\r\n const token = ref(\"\");\r\n const subscriptionsState = reactive({current: subscriptions.value!});\r\n const hasChanges = ref(false);\r\n\r\n watch(subscriptionsState, (newValue, oldValue) => {\r\n hasChanges.value = true;\r\n // fires on nested property mutations\r\n // Note: `newValue` will be equal to `oldValue` here\r\n // because they both point to the same object!\r\n });\r\n\r\n watch(enableNotifications, async (newValue, oldValue) => {\r\n if (newValue && (oldValue !== undefined && !oldValue))\r\n {\r\n console.log(\"attivazione notifiche\");\r\n await retrieveToken();\r\n await FirebaseMessaging.subscribeToTopic({topic: 'general'});\r\n await FcmManager.addListners();\r\n }\r\n else if (newValue !== undefined && !newValue && oldValue)\r\n {\r\n console.log(\"disattivazione notifiche\");\r\n await FirebaseMessaging.removeAllListeners();\r\n\r\n subscriptionsState.current.forEach(i=> i.isEnabled = false);\r\n const postdata: EditSubscriptionsDTO = { token: \"\", subscriptions: subscriptionsState.current};\r\n await store.dispatch('editEventSubscriptions',postdata);\r\n toastMessage.value = \"Impostazioni salvate!\";\r\n toastColor.value = \"success\";\r\n setIsToastOpen(true);\r\n }\r\n });\r\n\r\n const retrieveToken = async (): Promise => \r\n {\r\n const result = await FirebaseMessaging.checkPermissions();\r\n if( result.receive != \"granted\")\r\n {\r\n const requestResult = await FirebaseMessaging.requestPermissions();\r\n if (requestResult.receive == \"denied\")\r\n {\r\n console.log(\"Consenso attivazione notifiche negato\");\r\n enableNotifications.value = false;\r\n return;\r\n }\r\n else\r\n {\r\n console.log(\"Consenso attivazione notifiche consentito: \", requestResult.receive); \r\n }\r\n } \r\n\r\n const tokenResult = await FirebaseMessaging.getToken({});\r\n token.value = tokenResult.token;\r\n console.log(\"Token: \", token.value);\r\n };\r\n\r\n\r\n onMounted(async () => {\r\n try {\r\n setIsLoading(true);\r\n await store.dispatch('loadEventSubscriptions');\r\n console.log('subscriptions loaded: ', subscriptions.value );\r\n subscriptionsState.current = subscriptions.value!;\r\n const filtered = subscriptions.value!.filter(i=> i.isEnabled);\r\n enableNotifications.value = filtered && filtered.length > 0;\r\n setIsLoading(false);\r\n } catch (err: any) {\r\n Utils.PresentAlertError(\"Errore caricamento dati\", err.message, [\r\n \"Ok\",\r\n ]);\r\n }\r\n });\r\n\r\n const onSave = async () => {\r\n try{\r\n console.log(\"onSave\");\r\n const postdata: EditSubscriptionsDTO = { token: token.value, subscriptions: subscriptionsState.current};\r\n await store.dispatch('editEventSubscriptions',postdata);\r\n toastMessage.value = \"Impostazioni salvate!\";\r\n toastColor.value = \"success\";\r\n setIsToastOpen(true);\r\n }\r\n catch (err: any) {\r\n Utils.PresentAlertError(\"Errore durante il salvataggio dei dati\", err.message, [\r\n \"Ok\",\r\n ]);\r\n }\r\n }\r\n\r\n return {\r\n lang,\r\n isLoading,\r\n isToastOpen,\r\n setIsToastOpen,\r\n setIsLoading,\r\n user,\r\n toastMessage,\r\n toastColor, \r\n subscriptionsState,\r\n hasChanges,\r\n onSave,\r\n enableNotifications\r\n };\r\n },\r\n});\r\n","import { render } from \"./AccountNotifications.vue?vue&type=template&id=b7927814&ts=true\"\nimport script from \"./AccountNotifications.vue?vue&type=script&lang=ts\"\nexport * from \"./AccountNotifications.vue?vue&type=script&lang=ts\"\n\nimport \"./AccountNotifications.vue?vue&type=style&index=0&id=b7927814&lang=css\"\n\nimport exportComponent from \"C:\\\\Projects\\\\Aldilapp\\\\ionic-capacitor-v3\\\\ionic\\\\aldilapp\\\\node_modules\\\\vue-loader-v16\\\\dist\\\\exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"sourceRoot":""}