@chat21/chat21-ionic 2.0.13 → 3.0.5-9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-community-push-latest.yml +22 -0
- package/.github/workflows/docker-image-tag-community-tag-push.yml +21 -0
- package/CHANGELOG.md +637 -212
- package/Dockerfile +1 -2
- package/LICENSE +21 -661
- package/README.md +40 -9
- package/angular.json +230 -0
- package/browserslist +12 -0
- package/config.xml +60 -47
- package/deploy_pre.sh +14 -12
- package/deploy_prod.sh +26 -6
- package/env.sample +28 -9
- package/ionic.config.json +2 -2
- package/karma.conf.js +31 -0
- package/nginx.conf +1 -1
- package/package.json +91 -105
- package/publish_pre.sh +33 -0
- package/publish_prod.sh +33 -0
- package/resources/Android/icon/drawable-hdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-ldpi-icon.png +0 -0
- package/resources/Android/icon/drawable-mdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/Android/icon.png +0 -0
- package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash.png +0 -0
- package/src/app/app-routing.module.ts +90 -0
- package/src/app/app.component.html +26 -0
- package/src/app/app.component.scss +11 -0
- package/src/app/app.component.spec.ts +47 -0
- package/src/app/app.component.ts +1154 -128
- package/src/app/app.module.ts +314 -135
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +143 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.scss +335 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.spec.ts +179 -0
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +303 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +149 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +199 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.spec.ts +24 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +97 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.html +17 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.scss +83 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.spec.ts +27 -0
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.ts +43 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +76 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +51 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +84 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +215 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +3 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +83 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +37 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +24 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +61 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +30 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +3 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +47 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +29 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +3 -0
- package/{bin/chat21-ionic → src/app/chatlib/conversation-detail/message/frame/frame.component.scss} +0 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +10 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.scss +34 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.spec.ts +35 -0
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +78 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.html +2 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +15 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.spec.ts +27 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +35 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +56 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +169 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.spec.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +80 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +18 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +27 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.ts +24 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.html +5 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.scss +26 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.spec.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/text/text.component.ts +56 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +154 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +222 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.spec.ts +24 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +113 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +46 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.scss +200 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.spec.ts +27 -0
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +135 -0
- package/src/app/components/authentication/login/login.component.html +65 -0
- package/src/app/components/authentication/login/login.component.scss +85 -0
- package/src/app/components/authentication/login/login.component.spec.ts +24 -0
- package/src/app/components/authentication/login/login.component.ts +174 -0
- package/src/app/components/contacts-directory/contacts-directory.component.html +22 -0
- package/src/app/components/contacts-directory/contacts-directory.component.scss +123 -0
- package/src/app/components/contacts-directory/contacts-directory.component.spec.ts +24 -0
- package/src/app/components/contacts-directory/contacts-directory.component.ts +109 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +3 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +21 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +14 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +54 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +98 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +84 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +30 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +83 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +68 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +3 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +10 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +14 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +71 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +161 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +133 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +64 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +124 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.spec.ts +25 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +685 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.html +13 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.spec.ts +24 -0
- package/src/app/components/conversation-detail/option-header/option-header.component.ts +24 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +64 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.scss +135 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.spec.ts +24 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.ts +53 -0
- package/src/app/components/conversation-info/conversation-info.module.ts +13 -0
- package/src/app/components/conversation-info/info-content/info-content.component.html +18 -0
- package/src/app/components/conversation-info/info-content/info-content.component.scss +5 -0
- package/src/app/components/conversation-info/info-content/info-content.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-content/info-content.component.ts +395 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.html +57 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.scss +62 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-direct/info-direct.component.ts +67 -0
- package/src/app/components/conversation-info/info-group/info-group.component.html +115 -0
- package/src/app/components/conversation-info/info-group/info-group.component.scss +80 -0
- package/src/app/components/conversation-info/info-group/info-group.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-group/info-group.component.ts +218 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +6 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.scss +0 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.spec.ts +24 -0
- package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +29 -0
- package/src/app/components/ddp-header/ddp-header.component.html +31 -0
- package/src/app/components/ddp-header/ddp-header.component.scss +26 -0
- package/src/app/components/ddp-header/ddp-header.component.spec.ts +24 -0
- package/src/app/components/ddp-header/ddp-header.component.ts +33 -0
- package/src/app/components/image-viewer/image-viewer.component.html +23 -0
- package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
- package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
- package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
- package/src/app/components/project-item/project-item.component.html +147 -0
- package/src/app/components/project-item/project-item.component.scss +669 -0
- package/src/app/components/project-item/project-item.component.spec.ts +24 -0
- package/src/app/components/project-item/project-item.component.ts +350 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +12 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.scss +29 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.spec.ts +24 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +41 -0
- package/src/app/components/utils/user-presence/user-presence.component.html +2 -0
- package/src/app/components/utils/user-presence/user-presence.component.scss +24 -0
- package/src/app/components/utils/user-presence/user-presence.component.spec.ts +24 -0
- package/src/app/components/utils/user-presence/user-presence.component.ts +159 -0
- package/src/app/directives/autofocus.directive.ts +41 -0
- package/src/app/directives/html-entities-encode.pipe.spec.ts +8 -0
- package/src/app/directives/html-entities-encode.pipe.ts +17 -0
- package/src/app/directives/marked.pipe.spec.ts +8 -0
- package/src/app/directives/marked.pipe.ts +27 -0
- package/src/app/directives/safe-html.pipe.ts +16 -0
- package/src/app/pages/authentication/login/login-routing.module.ts +17 -0
- package/src/app/pages/authentication/login/login.module.ts +39 -0
- package/src/app/pages/authentication/login/login.page.html +7 -0
- package/src/app/pages/authentication/login/login.page.scss +5 -0
- package/src/app/pages/authentication/login/login.page.spec.ts +24 -0
- package/src/app/pages/authentication/login/login.page.ts +187 -0
- package/src/app/pages/contacts-directory/contacts-directory-routing.module.ts +17 -0
- package/src/app/pages/contacts-directory/contacts-directory.module.ts +42 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.html +19 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.scss +0 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.spec.ts +24 -0
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +125 -0
- package/src/app/pages/conversation-detail/conversation-detail-routing.module.ts +17 -0
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +69 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.html +191 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +492 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.spec.ts +24 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +1525 -0
- package/src/app/pages/conversations-list/conversations-list-routing.module.ts +17 -0
- package/src/app/pages/conversations-list/conversations-list.module.ts +43 -0
- package/src/app/pages/conversations-list/conversations-list.page.html +112 -0
- package/src/app/pages/conversations-list/conversations-list.page.scss +302 -0
- package/src/app/pages/conversations-list/conversations-list.page.spec.ts +24 -0
- package/src/app/pages/conversations-list/conversations-list.page.ts +1032 -0
- package/src/app/pages/details/details-routing.module.ts +17 -0
- package/src/app/pages/details/details.module.ts +21 -0
- package/src/app/pages/details/details.page.html +28 -0
- package/src/app/pages/details/details.page.scss +23 -0
- package/src/app/pages/details/details.page.spec.ts +24 -0
- package/src/app/pages/details/details.page.ts +65 -0
- package/src/app/pages/loader-preview/loader-preview-routing.module.ts +17 -0
- package/src/app/pages/loader-preview/loader-preview.module.ts +29 -0
- package/src/app/pages/loader-preview/loader-preview.page.html +62 -0
- package/src/app/pages/loader-preview/loader-preview.page.scss +117 -0
- package/src/app/pages/loader-preview/loader-preview.page.spec.ts +24 -0
- package/src/app/pages/loader-preview/loader-preview.page.ts +353 -0
- package/src/app/pages/profile-info/profile-info-routing.module.ts +17 -0
- package/src/app/pages/profile-info/profile-info.module.ts +41 -0
- package/src/app/pages/profile-info/profile-info.page.html +86 -0
- package/src/app/pages/profile-info/profile-info.page.scss +264 -0
- package/src/app/pages/profile-info/profile-info.page.spec.ts +24 -0
- package/src/app/pages/profile-info/profile-info.page.ts +223 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +116 -0
- package/src/app/services/app-config.ts +107 -0
- package/src/app/services/canned-responses/canned-responses.service.spec.ts +12 -0
- package/src/app/services/canned-responses/canned-responses.service.ts +49 -0
- package/src/app/services/contacts/contacts.service.spec.ts +12 -0
- package/src/app/services/contacts/contacts.service.ts +172 -0
- package/src/app/services/events-service.ts +79 -0
- package/src/app/services/nav-proxy.service.spec.ts +12 -0
- package/src/app/services/nav-proxy.service.ts +80 -0
- package/src/app/services/network-service/network.service.spec.ts +12 -0
- package/src/app/services/network-service/network.service.ts +46 -0
- package/src/app/services/tiledesk/tiledesk.service.spec.ts +12 -0
- package/src/app/services/tiledesk/tiledesk.service.ts +99 -0
- package/src/app/services/websocket/websocket-js.ts +560 -0
- package/src/app/services/websocket/websocket.service.spec.ts +12 -0
- package/src/app/services/websocket/websocket.service.ts +292 -0
- package/src/app/shared/shared-conversation-info.module.ts +33 -0
- package/src/app/shared/shared.module.ts +130 -0
- package/src/{utils → app/utils}/constants.ts-e +0 -0
- package/src/app/utils/scrollbar-theme.directive.ts +63 -0
- package/src/assets/i18n/en.json +122 -38
- package/src/assets/i18n/it.json +101 -10
- package/src/assets/icon/favicon.ico +0 -0
- package/src/assets/icon/ionic_favicon.png +0 -0
- package/src/assets/images/f21ico-done.svg +1 -0
- package/src/assets/images/f21ico-done_all.svg +1 -0
- package/src/assets/images/f21ico-schedule.svg +1 -0
- package/src/assets/images/file-alt-solid.png +0 -0
- package/src/assets/images/no_conversation.jpg +0 -0
- package/src/assets/{img → images}/no_image.png +0 -0
- package/src/assets/js/chat21client.js +1027 -0
- package/src/assets/js/mqtt/4.1.0/mqtt.min.js +1 -0
- package/src/assets/js/mqtt/4.2.6/mqtt.min.js +1 -0
- package/src/assets/js/mqtt/4.2.8/mqtt.min.js +1 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/shapes.svg +1 -0
- package/src/assets/sounds/pling.mp3 +0 -0
- package/src/assets/transparent.png +0 -0
- package/src/chat-config-mqtt-ver-uploaded.json +22 -0
- package/src/chat-config-mqtt.json +26 -0
- package/src/chat-config-pre-test.json +32 -0
- package/src/chat-config-pre.json +23 -0
- package/src/chat-config-template.json +20 -6
- package/src/chat-config.json +30 -0
- package/src/{models → chat21-core/models}/conversation.ts +6 -2
- package/src/{models → chat21-core/models}/group.ts +7 -5
- package/src/{models → chat21-core/models}/message.ts +8 -8
- package/src/{models → chat21-core/models}/upload.ts +5 -5
- package/src/{models → chat21-core/models}/user.ts +2 -1
- package/src/chat21-core/providers/abstract/app-storage.service.spec.ts +15 -0
- package/src/chat21-core/providers/abstract/app-storage.service.ts +17 -0
- package/src/chat21-core/providers/abstract/archivedconversations-handler.service.spec.ts +13 -0
- package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +34 -0
- package/src/chat21-core/providers/abstract/conversation-handler-builder.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversation-handler-builder.service.ts +11 -0
- package/src/chat21-core/providers/abstract/conversation-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversation-handler.service.ts +43 -0
- package/src/chat21-core/providers/abstract/conversations-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +42 -0
- package/src/chat21-core/providers/abstract/groups-handler.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/groups-handler.service.ts +28 -0
- package/src/chat21-core/providers/abstract/image-repo.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/image-repo.service.ts +26 -0
- package/src/chat21-core/providers/abstract/logger.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/logger.service.ts +16 -0
- package/src/chat21-core/providers/abstract/messagingAuth.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/messagingAuth.service.ts +54 -0
- package/src/chat21-core/providers/abstract/notifications.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/notifications.service.ts +31 -0
- package/src/chat21-core/providers/abstract/presence.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/presence.service.ts +34 -0
- package/src/chat21-core/providers/abstract/typing.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/typing.service.ts +31 -0
- package/src/chat21-core/providers/abstract/upload.service.spec.ts +12 -0
- package/src/chat21-core/providers/abstract/upload.service.ts +39 -0
- package/src/chat21-core/providers/chat-manager.ts +282 -0
- package/src/chat21-core/providers/custom-translate.service.spec.ts +12 -0
- package/src/chat21-core/providers/custom-translate.service.ts +42 -0
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +476 -0
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +376 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler-builder.service.ts +19 -0
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +416 -0
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +570 -0
- package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +303 -0
- package/src/chat21-core/providers/firebase/firebase-image-repo.ts +40 -0
- package/src/chat21-core/providers/firebase/firebase-init-service.ts +31 -0
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +246 -0
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +190 -0
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +93 -0
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +106 -0
- package/src/chat21-core/providers/localSessionStorage.ts +215 -0
- package/src/chat21-core/providers/logger/customLogger.ts +70 -0
- package/src/chat21-core/providers/logger/loggerInstance.ts +20 -0
- package/src/chat21-core/providers/mqtt/chat-service.ts +44 -0
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +707 -0
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +313 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler-builder.service.ts +25 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +446 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +601 -0
- package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +139 -0
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +122 -0
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +229 -0
- package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +93 -0
- package/src/chat21-core/providers/native/native-image-repo.ts +30 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +85 -0
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +12 -0
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +211 -0
- package/src/chat21-core/utils/constants.ts +109 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.html +6 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.scss +62 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.spec.ts +24 -0
- package/src/chat21-core/utils/user-typing/user-typing.component.ts +114 -0
- package/src/chat21-core/utils/utils-message.ts +117 -0
- package/src/chat21-core/utils/utils-user.ts +46 -0
- package/src/chat21-core/utils/utils.ts +893 -0
- package/src/firebase-messaging-sw-template.js +1 -1
- package/src/global.scss +585 -0
- package/src/index.html +71 -42
- package/src/main.ts +12 -0
- package/src/manifest.json +0 -11
- package/src/models/department.ts +12 -0
- package/src/polyfills.ts +73 -0
- package/src/test.ts +21 -0
- package/src/theme/variables.scss +236 -93
- package/src/variables.scss +30 -0
- package/src/zone-flags.ts +5 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +23 -18
- package/tsconfig.spec.json +19 -0
- package/tslint.json +84 -7
- package/app.json +0 -7
- package/curl +0 -1
- package/deploy_dev.sh +0 -28
- package/docs/changelog.html +0 -227
- package/docs/classes/ConversationModel.html +0 -1022
- package/docs/classes/GroupModel.html +0 -527
- package/docs/classes/MessageModel.html +0 -843
- package/docs/classes/UploadModel.html +0 -417
- package/docs/classes/UserModel.html +0 -728
- package/docs/classes/_DetailPage.html +0 -144
- package/docs/classes/_MasterPage.html +0 -144
- package/docs/components/ArchivedConversationsPage.html +0 -1024
- package/docs/components/ChatBubble.html +0 -327
- package/docs/components/DettaglioConversazionePage.html +0 -6060
- package/docs/components/ElasticTextarea.html +0 -619
- package/docs/components/InfoAdvancedPage.html +0 -656
- package/docs/components/InfoConversationPage.html +0 -5681
- package/docs/components/InfoMessagePage.html +0 -993
- package/docs/components/InfoUserPage.html +0 -1420
- package/docs/components/ListaConversazioniPage.html +0 -3576
- package/docs/components/LoginPage.html +0 -1457
- package/docs/components/MyApp.html +0 -1388
- package/docs/components/PlaceholderPage.html +0 -397
- package/docs/components/PopoverPage.html +0 -986
- package/docs/components/PopoverProfilePage.html +0 -639
- package/docs/components/ProfilePage.html +0 -1187
- package/docs/components/RegisterPage.html +0 -1271
- package/docs/components/ResetpwdPage.html +0 -1039
- package/docs/components/UpdateImageProfilePage.html +0 -997
- package/docs/components/UsersPage.html +0 -1297
- package/docs/coverage.html +0 -1421
- package/docs/dependencies.html +0 -210
- package/docs/directives/AutosizeDirective.html +0 -556
- package/docs/fonts/FontAwesome.otf +0 -0
- package/docs/fonts/fontawesome-webfont.eot +0 -0
- package/docs/fonts/fontawesome-webfont.svg +0 -685
- package/docs/fonts/fontawesome-webfont.ttf +0 -0
- package/docs/fonts/fontawesome-webfont.woff +0 -0
- package/docs/fonts/fontawesome-webfont.woff2 +0 -0
- package/docs/fonts/ionicons.eot +0 -0
- package/docs/fonts/ionicons.svg +0 -2090
- package/docs/fonts/ionicons.ttf +0 -0
- package/docs/fonts/ionicons.woff +0 -0
- package/docs/fonts/ionicons.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-300.eot +0 -0
- package/docs/fonts/roboto-v15-latin-300.svg +0 -314
- package/docs/fonts/roboto-v15-latin-300.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-700.eot +0 -0
- package/docs/fonts/roboto-v15-latin-700.svg +0 -310
- package/docs/fonts/roboto-v15-latin-700.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-italic.eot +0 -0
- package/docs/fonts/roboto-v15-latin-italic.svg +0 -323
- package/docs/fonts/roboto-v15-latin-italic.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-regular.eot +0 -0
- package/docs/fonts/roboto-v15-latin-regular.svg +0 -308
- package/docs/fonts/roboto-v15-latin-regular.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff2 +0 -0
- package/docs/graph/dependencies.svg +0 -870
- package/docs/images/compodoc-vectorise-inverted.png +0 -0
- package/docs/images/compodoc-vectorise-inverted.svg +0 -201
- package/docs/images/compodoc-vectorise.png +0 -0
- package/docs/images/compodoc-vectorise.svg +0 -201
- package/docs/images/coverage-badge-documentation.svg +0 -9
- package/docs/images/coverage-badge.svg +0 -9
- package/docs/images/favicon.ico +0 -0
- package/docs/index.html +0 -233
- package/docs/injectables/AppConfigProvider.html +0 -411
- package/docs/injectables/AuthService.html +0 -1016
- package/docs/injectables/ChatArchivedConversationsHandler.html +0 -1832
- package/docs/injectables/ChatContactsSynchronizer.html +0 -841
- package/docs/injectables/ChatConversationHandler.html +0 -1960
- package/docs/injectables/ChatConversationsHandler.html +0 -2584
- package/docs/injectables/ChatManager.html +0 -1779
- package/docs/injectables/ChatPresenceHandler.html +0 -1187
- package/docs/injectables/CustomTranslateService.html +0 -496
- package/docs/injectables/DatabaseProvider.html +0 -1444
- package/docs/injectables/GroupService.html +0 -1458
- package/docs/injectables/MessagingService.html +0 -1165
- package/docs/injectables/NavProxyService.html +0 -1028
- package/docs/injectables/TiledeskConversationProvider.html +0 -945
- package/docs/injectables/UploadService.html +0 -791
- package/docs/injectables/UserService.html +0 -1612
- package/docs/js/compodoc.js +0 -14
- package/docs/js/lazy-load-graphs.js +0 -44
- package/docs/js/libs/EventDispatcher.js +0 -5
- package/docs/js/libs/bootstrap-native.js +0 -2
- package/docs/js/libs/clipboard.min.js +0 -7
- package/docs/js/libs/custom-elements-es5-adapter.js +0 -15
- package/docs/js/libs/custom-elements.min.js +0 -38
- package/docs/js/libs/d3.v3.min.js +0 -2
- package/docs/js/libs/deep-iterator.js +0 -2
- package/docs/js/libs/es6-shim.min.js +0 -11
- package/docs/js/libs/htmlparser.js +0 -23
- package/docs/js/libs/innersvg.js +0 -9
- package/docs/js/libs/lit-html.js +0 -1
- package/docs/js/libs/prism.js +0 -14
- package/docs/js/libs/promise.min.js +0 -6
- package/docs/js/libs/svg-pan-zoom.min.js +0 -3
- package/docs/js/libs/tablesort.min.js +0 -6
- package/docs/js/libs/tablesort.number.min.js +0 -6
- package/docs/js/libs/vis.min.js +0 -46
- package/docs/js/libs/zepto.min.js +0 -2
- package/docs/js/menu-wc.js +0 -594
- package/docs/js/menu.js +0 -261
- package/docs/js/routes.js +0 -280
- package/docs/js/search/lunr.min.js +0 -6
- package/docs/js/search/search-lunr.js +0 -67
- package/docs/js/search/search.js +0 -268
- package/docs/js/search/search_index.js +0 -4
- package/docs/js/sourceCode.js +0 -58
- package/docs/js/svg-pan-zoom.controls.js +0 -53
- package/docs/js/tabs.js +0 -21
- package/docs/js/tree.js +0 -147
- package/docs/license.html +0 -664
- package/docs/miscellaneous/functions.html +0 -2417
- package/docs/miscellaneous/variables.html +0 -994
- package/docs/modules/AppModule/dependencies.svg +0 -454
- package/docs/modules/AppModule.html +0 -967
- package/docs/modules/ArchivedConversationsPageModule/dependencies.svg +0 -50
- package/docs/modules/ArchivedConversationsPageModule.html +0 -225
- package/docs/modules/DettaglioConversazionePageModule/dependencies.svg +0 -66
- package/docs/modules/DettaglioConversazionePageModule.html +0 -256
- package/docs/modules/InfoAdvancedPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoAdvancedPageModule.html +0 -225
- package/docs/modules/InfoConversationPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoConversationPageModule.html +0 -227
- package/docs/modules/InfoUserPageModule/dependencies.svg +0 -50
- package/docs/modules/InfoUserPageModule.html +0 -225
- package/docs/modules/ListaConversazioniPageModule/dependencies.svg +0 -66
- package/docs/modules/ListaConversazioniPageModule.html +0 -255
- package/docs/modules/LoginModule/dependencies.svg +0 -66
- package/docs/modules/LoginModule.html +0 -253
- package/docs/modules/PlaceholderPageModule/dependencies.svg +0 -66
- package/docs/modules/PlaceholderPageModule.html +0 -253
- package/docs/modules/PopoverPageModule/dependencies.svg +0 -66
- package/docs/modules/PopoverPageModule.html +0 -253
- package/docs/modules/PopoverProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/PopoverProfilePageModule.html +0 -253
- package/docs/modules/ProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/ProfilePageModule.html +0 -253
- package/docs/modules/RegisterModule/dependencies.svg +0 -66
- package/docs/modules/RegisterModule.html +0 -253
- package/docs/modules/ResetpwdModule/dependencies.svg +0 -66
- package/docs/modules/ResetpwdModule.html +0 -253
- package/docs/modules/UpdateImageProfilePageModule/dependencies.svg +0 -66
- package/docs/modules/UpdateImageProfilePageModule.html +0 -253
- package/docs/modules/UsersModule/dependencies.svg +0 -66
- package/docs/modules/UsersModule.html +0 -253
- package/docs/modules.html +0 -379
- package/docs/overview.html +0 -1033
- package/docs/styles/bootstrap-card.css +0 -219
- package/docs/styles/bootstrap.min.css +0 -5
- package/docs/styles/compodoc.css +0 -996
- package/docs/styles/font-awesome.min.css +0 -4
- package/docs/styles/ionicons.min.css +0 -11
- package/docs/styles/laravel.css +0 -69
- package/docs/styles/material.css +0 -109
- package/docs/styles/original.css +0 -47
- package/docs/styles/postmark.css +0 -224
- package/docs/styles/prism.css +0 -267
- package/docs/styles/readthedocs.css +0 -108
- package/docs/styles/reset.css +0 -48
- package/docs/styles/stripe.css +0 -65
- package/docs/styles/style.css +0 -7
- package/docs/styles/tablesort.css +0 -33
- package/docs/styles/vagrant.css +0 -96
- package/firebase-functions/.firebaserc +0 -5
- package/firebase-functions/firebase.json +0 -1
- package/firebase-functions/functions/index.js +0 -208
- package/firebase-functions/functions/package.json +0 -9
- package/google-services.json +0 -42
- package/hooks/README.md +0 -196
- package/resources/android/icon/drawable-hdpi-icon.png +0 -0
- package/resources/android/icon/drawable-ldpi-icon.png +0 -0
- package/resources/android/icon/drawable-mdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/icon.png +0 -0
- package/resources/icon.png.md5 +0 -1
- package/resources/ios/icon/icon-1024.png +0 -0
- package/resources/ios/icon/icon-40.png +0 -0
- package/resources/ios/icon/icon-40@2x.png +0 -0
- package/resources/ios/icon/icon-40@3x.png +0 -0
- package/resources/ios/icon/icon-50.png +0 -0
- package/resources/ios/icon/icon-50@2x.png +0 -0
- package/resources/ios/icon/icon-60.png +0 -0
- package/resources/ios/icon/icon-60@2x.png +0 -0
- package/resources/ios/icon/icon-60@3x.png +0 -0
- package/resources/ios/icon/icon-72.png +0 -0
- package/resources/ios/icon/icon-72@2x.png +0 -0
- package/resources/ios/icon/icon-76.png +0 -0
- package/resources/ios/icon/icon-76@2x.png +0 -0
- package/resources/ios/icon/icon-83.5@2x.png +0 -0
- package/resources/ios/icon/icon-small.png +0 -0
- package/resources/ios/icon/icon-small@2x.png +0 -0
- package/resources/ios/icon/icon-small@3x.png +0 -0
- package/resources/ios/icon/icon.png +0 -0
- package/resources/ios/icon/icon@2x.png +0 -0
- package/resources/ios/splash/Default-568h@2x~iphone.png +0 -0
- package/resources/ios/splash/Default-667h.png +0 -0
- package/resources/ios/splash/Default-736h.png +0 -0
- package/resources/ios/splash/Default-Landscape-736h.png +0 -0
- package/resources/ios/splash/Default-Landscape@2x~ipad.png +0 -0
- package/resources/ios/splash/Default-Landscape@~ipadpro.png +0 -0
- package/resources/ios/splash/Default-Landscape~ipad.png +0 -0
- package/resources/ios/splash/Default-Portrait@2x~ipad.png +0 -0
- package/resources/ios/splash/Default-Portrait@~ipadpro.png +0 -0
- package/resources/ios/splash/Default-Portrait~ipad.png +0 -0
- package/resources/ios/splash/Default@2x~iphone.png +0 -0
- package/resources/ios/splash/Default@2x~universal~anyany.png +0 -0
- package/resources/ios/splash/Default~iphone.png +0 -0
- package/resources/splash.png +0 -0
- package/resources/splash.png.md5 +0 -1
- package/server.js +0 -7
- package/src/app/app.html +0 -56
- package/src/app/app.scss +0 -236
- package/src/app/main.ts +0 -9
- package/src/assets/chat-background.jpg +0 -0
- package/src/assets/chat21-ionic-pattern-2.svg +0 -5110
- package/src/assets/chat21-ionic-pattern.png +0 -0
- package/src/assets/chat21-ionic-pattern.svg +0 -1
- package/src/assets/download.svg +0 -1
- package/src/assets/dummyDump.sql +0 -1
- package/src/assets/icon/favicon_old.ico +0 -0
- package/src/assets/img/c21-down-gray.svg +0 -1
- package/src/assets/img/chat21-icon.png +0 -0
- package/src/assets/img/f21ico-attached.svg +0 -1
- package/src/assets/img/f21ico-close.svg +0 -1
- package/src/assets/img/f21ico-photo.svg +0 -1
- package/src/assets/img/ic_keyboard_arrow_down_black_24px.svg +0 -4
- package/src/assets/img/ic_keyboard_arrow_down_white_24px.svg +0 -4
- package/src/assets/img/icon.png +0 -0
- package/src/assets/message-mine.png +0 -0
- package/src/assets/message-other.png +0 -0
- package/src/assets/pling.mp3 +0 -0
- package/src/assets/splash.png +0 -0
- package/src/declarations.d.ts +0 -14
- package/src/directives/autosize/autosize.ts +0 -82
- package/src/environments/environment.pre.ts +0 -22
- package/src/environments/environment.prod.ts +0 -22
- package/src/environments/environment.ts +0 -21
- package/src/pages/_DetailPage.ts +0 -1
- package/src/pages/_MasterPage.ts +0 -1
- package/src/pages/archived-conversations/archived-conversations.html +0 -32
- package/src/pages/archived-conversations/archived-conversations.module.ts +0 -13
- package/src/pages/archived-conversations/archived-conversations.scss +0 -153
- package/src/pages/archived-conversations/archived-conversations.ts +0 -121
- package/src/pages/authentication/login/login.html +0 -58
- package/src/pages/authentication/login/login.module.ts +0 -16
- package/src/pages/authentication/login/login.scss +0 -121
- package/src/pages/authentication/login/login.ts +0 -221
- package/src/pages/authentication/register/register.html +0 -88
- package/src/pages/authentication/register/register.module.ts +0 -16
- package/src/pages/authentication/register/register.scss +0 -95
- package/src/pages/authentication/register/register.ts +0 -122
- package/src/pages/authentication/resetpwd/resetpwd.html +0 -40
- package/src/pages/authentication/resetpwd/resetpwd.module.ts +0 -16
- package/src/pages/authentication/resetpwd/resetpwd.scss +0 -102
- package/src/pages/authentication/resetpwd/resetpwd.ts +0 -93
- package/src/pages/components/chatBubble_old/chatBubble.scss +0 -83
- package/src/pages/components/chatBubble_old/chatBubble.ts +0 -30
- package/src/pages/components/elasticTextarea_old.ts +0 -46
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.html +0 -261
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.module.ts +0 -19
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.scss +0 -701
- package/src/pages/dettaglio-conversazione/dettaglio-conversazione.ts +0 -1395
- package/src/pages/index.ts +0 -5
- package/src/pages/info-advanced/info-advanced.html +0 -90
- package/src/pages/info-advanced/info-advanced.module.ts +0 -13
- package/src/pages/info-advanced/info-advanced.scss +0 -196
- package/src/pages/info-advanced/info-advanced.ts +0 -44
- package/src/pages/info-conversation/info-conversation.html +0 -225
- package/src/pages/info-conversation/info-conversation.module.ts +0 -15
- package/src/pages/info-conversation/info-conversation.scss +0 -444
- package/src/pages/info-conversation/info-conversation.ts +0 -1233
- package/src/pages/info-message/info-message.html +0 -74
- package/src/pages/info-message/info-message.module.ts +0 -13
- package/src/pages/info-message/info-message.scss +0 -216
- package/src/pages/info-message/info-message.ts +0 -89
- package/src/pages/info-user/info-user.html +0 -89
- package/src/pages/info-user/info-user.module.ts +0 -13
- package/src/pages/info-user/info-user.scss +0 -187
- package/src/pages/info-user/info-user.ts +0 -177
- package/src/pages/lista-conversazioni/lista-conversazioni.html +0 -88
- package/src/pages/lista-conversazioni/lista-conversazioni.module.ts +0 -18
- package/src/pages/lista-conversazioni/lista-conversazioni.scss +0 -245
- package/src/pages/lista-conversazioni/lista-conversazioni.ts +0 -736
- package/src/pages/placeholder/placeholder.html +0 -3
- package/src/pages/placeholder/placeholder.module.ts +0 -16
- package/src/pages/placeholder/placeholder.scss +0 -23
- package/src/pages/placeholder/placeholder.ts +0 -18
- package/src/pages/popover/popover.html +0 -27
- package/src/pages/popover/popover.module.ts +0 -16
- package/src/pages/popover/popover.scss +0 -23
- package/src/pages/popover/popover.ts +0 -95
- package/src/pages/popover-profile/popover-profile.html +0 -20
- package/src/pages/popover-profile/popover-profile.module.ts +0 -16
- package/src/pages/popover-profile/popover-profile.scss +0 -10
- package/src/pages/popover-profile/popover-profile.ts +0 -40
- package/src/pages/profile/profile.html +0 -54
- package/src/pages/profile/profile.module.ts +0 -16
- package/src/pages/profile/profile.scss +0 -45
- package/src/pages/profile/profile.ts +0 -108
- package/src/pages/update-image-profile/update-image-profile.html +0 -39
- package/src/pages/update-image-profile/update-image-profile.module.ts +0 -16
- package/src/pages/update-image-profile/update-image-profile.scss +0 -50
- package/src/pages/update-image-profile/update-image-profile.ts +0 -111
- package/src/pages/users/users.html +0 -55
- package/src/pages/users/users.module.ts +0 -16
- package/src/pages/users/users.scss +0 -10
- package/src/pages/users/users.ts +0 -222
- package/src/providers/app-config/app-config.ts +0 -33
- package/src/providers/auth-service.ts +0 -140
- package/src/providers/canned-responses-service/canned-responses-service.ts +0 -57
- package/src/providers/chat-archived-conversations-handler.ts +0 -283
- package/src/providers/chat-contacts-synchronizer.ts +0 -179
- package/src/providers/chat-conversation-handler.ts +0 -547
- package/src/providers/chat-conversations-handler.ts +0 -519
- package/src/providers/chat-manager/chat-manager.ts +0 -246
- package/src/providers/chat-presence-handler.ts +0 -188
- package/src/providers/database/database.ts +0 -214
- package/src/providers/group/group.ts +0 -243
- package/src/providers/messaging-service.ts +0 -267
- package/src/providers/nav-proxy.ts +0 -104
- package/src/providers/tiledesk-conversation/tiledesk-conversation.ts +0 -134
- package/src/providers/translate-service.ts +0 -61
- package/src/providers/upload-service/upload-service.ts +0 -117
- package/src/providers/user/user.ts +0 -320
- package/src/service-worker.js +0 -30
- package/src/utils/constants.ts +0 -73
- package/src/utils/utils.ts +0 -548
- package/src/videochat.php +0 -20
package/src/app/app.component.ts
CHANGED
|
@@ -1,157 +1,1183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { URL_SOUND_LIST_CONVERSATION } from './../chat21-core/utils/constants';
|
|
2
|
+
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
|
|
3
|
+
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
4
|
+
|
|
5
|
+
import { Component, ViewChild, NgZone, OnInit, HostListener, ElementRef, Renderer2, AfterViewInit, } from '@angular/core';
|
|
6
|
+
import { Config, Platform, IonRouterOutlet, IonSplitPane, NavController, MenuController, AlertController, IonNav, ToastController } from '@ionic/angular';
|
|
7
|
+
import { ActivatedRoute, NavigationStart, Router } from '@angular/router';
|
|
8
|
+
import { Subscription, VirtualTimeScheduler } from 'rxjs';
|
|
9
|
+
import { ModalController } from '@ionic/angular';
|
|
10
|
+
|
|
11
|
+
// import * as firebase from 'firebase/app';
|
|
12
|
+
import firebase from "firebase/app";
|
|
13
|
+
import 'firebase/auth'; // nk in watch connection status
|
|
14
|
+
|
|
7
15
|
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
8
16
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
9
|
-
|
|
10
|
-
import { Config } from 'ionic-angular';
|
|
11
|
-
import {NavProxyService} from '../providers/nav-proxy';
|
|
12
|
-
//import {PlaceholderPage} from '../pages/placeholder/placeholder';
|
|
13
|
-
import { MessagingService } from '../providers/messaging-service';
|
|
14
|
-
import { ChatManager } from '../providers/chat-manager/chat-manager';
|
|
15
17
|
import { TranslateService } from '@ngx-translate/core';
|
|
16
18
|
|
|
19
|
+
// services
|
|
20
|
+
import { AppConfigProvider } from './services/app-config';
|
|
21
|
+
// import { UserService } from './services/user.service';
|
|
22
|
+
// import { CurrentUserService } from './services/current-user/current-user.service';
|
|
23
|
+
import { EventsService } from './services/events-service';
|
|
24
|
+
import { MessagingAuthService } from '../chat21-core/providers/abstract/messagingAuth.service';
|
|
25
|
+
import { PresenceService } from '../chat21-core/providers/abstract/presence.service';
|
|
26
|
+
import { TypingService } from '../chat21-core/providers/abstract/typing.service';
|
|
27
|
+
import { UploadService } from '../chat21-core/providers/abstract/upload.service';
|
|
28
|
+
// import { ChatPresenceHandler} from './services/chat-presence-handler';
|
|
29
|
+
import { NavProxyService } from './services/nav-proxy.service';
|
|
30
|
+
import { ChatManager } from 'src/chat21-core/providers/chat-manager';
|
|
31
|
+
// import { ChatConversationsHandler } from './services/chat-conversations-handler';
|
|
32
|
+
import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
|
|
33
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
|
|
34
|
+
|
|
35
|
+
// pages
|
|
36
|
+
import { LoginPage } from './pages/authentication/login/login.page';
|
|
37
|
+
import { ConversationListPage } from './pages/conversations-list/conversations-list.page';
|
|
38
|
+
|
|
39
|
+
// utils
|
|
40
|
+
import { createExternalSidebar, checkPlatformIsMobile, isGroup, getParameterByName } from '../chat21-core/utils/utils';
|
|
41
|
+
import { STORAGE_PREFIX, PLATFORM_MOBILE, PLATFORM_DESKTOP, CHAT_ENGINE_FIREBASE, AUTH_STATE_OFFLINE, AUTH_STATE_ONLINE } from '../chat21-core/utils/constants';
|
|
17
42
|
import { environment } from '../environments/environment';
|
|
18
|
-
import {
|
|
43
|
+
import { UserModel } from '../chat21-core/models/user';
|
|
44
|
+
import { ConversationModel } from 'src/chat21-core/models/conversation';
|
|
45
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
46
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
47
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
48
|
+
// FCM
|
|
49
|
+
import { NotificationsService } from 'src/chat21-core/providers/abstract/notifications.service';
|
|
50
|
+
import { getImageUrlThumbFromFirebasestorage } from 'src/chat21-core/utils/utils-user';
|
|
51
|
+
|
|
52
|
+
// import { Network } from '@ionic-native/network/ngx';
|
|
53
|
+
// import { Observable, Observer, fromEvent, merge, of } from 'rxjs';
|
|
54
|
+
// import { mapTo } from 'rxjs/operators';
|
|
55
|
+
import { TiledeskService } from './services/tiledesk/tiledesk.service';
|
|
56
|
+
import { NetworkService } from './services/network-service/network.service';
|
|
57
|
+
import * as PACKAGE from 'package.json';
|
|
58
|
+
import { filter } from 'rxjs/operators'
|
|
59
|
+
import { WebSocketJs } from './services/websocket/websocket-js';
|
|
60
|
+
import { Location } from '@angular/common'
|
|
61
|
+
// import { filter } from 'rxjs/operators';
|
|
19
62
|
|
|
20
63
|
@Component({
|
|
21
|
-
|
|
64
|
+
selector: 'app-root',
|
|
65
|
+
templateUrl: 'app.component.html',
|
|
66
|
+
styleUrls: ['app.component.scss']
|
|
22
67
|
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@ViewChild('detailNav') detailNav:
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
68
|
+
|
|
69
|
+
export class AppComponent implements OnInit {
|
|
70
|
+
@ViewChild('sidebarNav', { static: false }) sidebarNav: IonNav;
|
|
71
|
+
@ViewChild('detailNav', { static: false }) detailNav: IonRouterOutlet;
|
|
72
|
+
|
|
73
|
+
// public appIsOnline$: Observable<boolean> = undefined;
|
|
74
|
+
checkInternet: boolean;
|
|
75
|
+
|
|
76
|
+
private BSAuthStateChangedSubscriptionRef: Subscription;
|
|
77
|
+
public sidebarPage: any;
|
|
78
|
+
public notificationsEnabled: boolean;
|
|
31
79
|
public zone: NgZone;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
80
|
+
private platformIs: string;
|
|
81
|
+
private doitResize: any;
|
|
82
|
+
private timeModalLogin: any;
|
|
83
|
+
public tenant: string;
|
|
84
|
+
public persistence: string;
|
|
85
|
+
public authModal: any;
|
|
86
|
+
|
|
87
|
+
private audio: any;
|
|
88
|
+
private setIntervalTime: any;
|
|
89
|
+
private setTimeoutSound: any;
|
|
90
|
+
private isTabVisible: boolean = true;
|
|
91
|
+
private tabTitle: string;
|
|
92
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
93
|
+
public toastMsgErrorWhileUnsubscribingFromNotifications: string;
|
|
94
|
+
public toastMsgCloseToast: string;
|
|
95
|
+
public toastMsgWaitingForNetwork: string;
|
|
96
|
+
private modalOpen: boolean = false;
|
|
97
|
+
private hadBeenCalledOpenModal: boolean = false;
|
|
98
|
+
public missingConnectionToast: any
|
|
99
|
+
public executedInitializeAppByWatchConnection: boolean = false;
|
|
100
|
+
private version: string;
|
|
101
|
+
|
|
102
|
+
// private isOnline: boolean = false;
|
|
103
|
+
|
|
104
|
+
wsService: WebSocketJs;
|
|
105
|
+
|
|
51
106
|
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
107
|
+
private platform: Platform,
|
|
108
|
+
private splashScreen: SplashScreen,
|
|
109
|
+
private statusBar: StatusBar,
|
|
110
|
+
private appConfigProvider: AppConfigProvider,
|
|
111
|
+
public events: EventsService,
|
|
56
112
|
public config: Config,
|
|
57
|
-
public events: Events,
|
|
58
|
-
private navProxy: NavProxyService,
|
|
59
|
-
public alertCtrl: AlertController,
|
|
60
|
-
public msgService: MessagingService,
|
|
61
113
|
public chatManager: ChatManager,
|
|
62
114
|
public translate: TranslateService,
|
|
63
|
-
public
|
|
115
|
+
public alertController: AlertController,
|
|
116
|
+
public navCtrl: NavController,
|
|
117
|
+
// public userService: UserService,
|
|
118
|
+
// public currentUserService: CurrentUserService,
|
|
119
|
+
public modalController: ModalController,
|
|
120
|
+
public messagingAuthService: MessagingAuthService,
|
|
121
|
+
public tiledeskAuthService: TiledeskAuthService,
|
|
122
|
+
public presenceService: PresenceService,
|
|
123
|
+
private router: Router,
|
|
124
|
+
private route: ActivatedRoute,
|
|
125
|
+
private renderer: Renderer2,
|
|
126
|
+
private navService: NavProxyService,
|
|
127
|
+
// public chatPresenceHandler: ChatPresenceHandler,
|
|
128
|
+
public typingService: TypingService,
|
|
129
|
+
public uploadService: UploadService,
|
|
130
|
+
public appStorageService: AppStorageService,
|
|
131
|
+
|
|
132
|
+
// public chatConversationsHandler: ChatConversationsHandler,
|
|
133
|
+
public conversationsHandlerService: ConversationsHandlerService,
|
|
134
|
+
public archivedConversationsHandlerService: ArchivedConversationsHandlerService,
|
|
135
|
+
private translateService: CustomTranslateService,
|
|
136
|
+
public notificationsService: NotificationsService,
|
|
137
|
+
public toastController: ToastController,
|
|
138
|
+
// private network: Network,
|
|
139
|
+
// private tiledeskService: TiledeskService,
|
|
140
|
+
private networkService: NetworkService,
|
|
141
|
+
public webSocketJs: WebSocketJs,
|
|
142
|
+
public location: Location
|
|
64
143
|
) {
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
this.saveInStorageNumberOfOpenedChatTab();
|
|
147
|
+
this.listenChatAlreadyOpenWithoutParamsInMobileMode()
|
|
148
|
+
|
|
149
|
+
// this.listenToUrlChanges();
|
|
150
|
+
// this.getPageState();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
listenChatAlreadyOpenWithoutParamsInMobileMode() {
|
|
156
|
+
this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
|
|
157
|
+
// console.log('[APP-COMP] Chat is Already Open In Mobile Mode ', isAlreadyOpenInMobileMode)
|
|
158
|
+
if (isAlreadyOpenInMobileMode === true) {
|
|
159
|
+
this.checkPlatform()
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// listenToUrlChanges() {
|
|
165
|
+
// const self = this;
|
|
166
|
+
// // window.addEventListener('hashchange', function () {
|
|
167
|
+
// window.addEventListener('locationchange', function () {
|
|
168
|
+
|
|
169
|
+
// console.log('location changed!');
|
|
170
|
+
|
|
171
|
+
// const convId = getParameterByName('convId')
|
|
172
|
+
// console.log('[APP-COMP] getParameterByName convId ', convId)
|
|
173
|
+
// if (convId) {
|
|
174
|
+
// setTimeout(() => {
|
|
175
|
+
// self.events.publish('supportconvid:haschanged', convId);
|
|
176
|
+
// }, 0);
|
|
177
|
+
// }
|
|
178
|
+
|
|
179
|
+
// const contact_id = getParameterByName('contact_id')
|
|
180
|
+
// console.log('[APP-COMP] getParameterByName contact_id ', contact_id)
|
|
181
|
+
// const contact_fullname = getParameterByName('contact_fullname')
|
|
182
|
+
// console.log('[APP-COMP] getParameterByName contact_fullname ', contact_fullname)
|
|
183
|
+
// if (contact_id && contact_fullname) {
|
|
184
|
+
// setTimeout(() => {
|
|
185
|
+
// self.router.navigateByUrl('conversation-detail/' + contact_id + '/' + contact_fullname + '/new');
|
|
186
|
+
// self.events.publish('directconvid:haschanged', contact_id);
|
|
187
|
+
// }, 0);
|
|
188
|
+
|
|
189
|
+
// } else {
|
|
190
|
+
// // console.log('[APP-COMP] contact_id and contact_fullname are null')
|
|
191
|
+
// }
|
|
192
|
+
|
|
193
|
+
// const conversation_detail = getParameterByName('conversation_detail')
|
|
194
|
+
// // console.log('[APP-COMP] getParameterByName conversation_detail ', conversation_detail)
|
|
195
|
+
// if (conversation_detail) {
|
|
196
|
+
// setTimeout(() => {
|
|
197
|
+
// self.router.navigate(['conversation-detail/'])
|
|
198
|
+
// }, 0);
|
|
199
|
+
// }
|
|
200
|
+
// });
|
|
201
|
+
// }
|
|
202
|
+
|
|
203
|
+
// getPageState() {
|
|
204
|
+
// const getState = () => {
|
|
205
|
+
|
|
206
|
+
// console.log('[APP-COMP] getState')
|
|
207
|
+
// // localStorage.setItem('visibilityState', document.visibilityState)
|
|
208
|
+
// if (document.visibilityState === 'hidden') {
|
|
209
|
+
// return 'hidden';
|
|
210
|
+
// }
|
|
211
|
+
// if (document.hasFocus()) {
|
|
212
|
+
// return 'active';
|
|
213
|
+
// }
|
|
214
|
+
// return 'passive';
|
|
215
|
+
// };
|
|
216
|
+
|
|
217
|
+
// let state = getState();
|
|
218
|
+
|
|
219
|
+
// const logStateChange = (nextState) => {
|
|
220
|
+
|
|
221
|
+
// const prevState = state;
|
|
222
|
+
// if (nextState !== prevState) {
|
|
223
|
+
// console.log(`State change: ${prevState} >>> ${nextState}`);
|
|
224
|
+
// state = nextState;
|
|
225
|
+
|
|
226
|
+
// }
|
|
227
|
+
// };
|
|
228
|
+
|
|
229
|
+
// ['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'].forEach((type) => {
|
|
230
|
+
// window.addEventListener(type, () => logStateChange(getState()), { capture: true });
|
|
231
|
+
// });
|
|
232
|
+
|
|
233
|
+
// // The next two listeners, on the other hand, can determine the next
|
|
234
|
+
// // state from the event itself.
|
|
235
|
+
// window.addEventListener('freeze', () => {
|
|
236
|
+
// // In the freeze event, the next state is always frozen.
|
|
237
|
+
// logStateChange('frozen');
|
|
238
|
+
// }, { capture: true });
|
|
239
|
+
|
|
240
|
+
// window.addEventListener('pagehide', (event) => {
|
|
241
|
+
// if (event.persisted) {
|
|
242
|
+
// // If the event's persisted property is `true` the page is about
|
|
243
|
+
// // to enter the Back-Forward Cache, which is also in the frozen state.
|
|
244
|
+
// logStateChange('frozen');
|
|
245
|
+
// localStorage.setItem('state', 'frozen')
|
|
246
|
+
// } else {
|
|
247
|
+
// // If the event's persisted property is not `true` the page is
|
|
248
|
+
// // about to be unloaded.
|
|
249
|
+
// logStateChange('terminated');
|
|
250
|
+
// localStorage.setItem('state', 'terminated')
|
|
251
|
+
// localStorage.setItem('terminated', 'true')
|
|
252
|
+
// }
|
|
253
|
+
// }, { capture: true });
|
|
254
|
+
|
|
255
|
+
// }
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
saveInStorageNumberOfOpenedChatTab() {
|
|
259
|
+
this.logger.log('Calling saveInStorageChatOpenedTab!');
|
|
260
|
+
|
|
261
|
+
// https://jsfiddle.net/jjjs5wd3/3/å
|
|
262
|
+
if (+localStorage.tabCount > 0) {
|
|
263
|
+
this.logger.log('Chat IONIC Already open!');
|
|
264
|
+
} else {
|
|
265
|
+
localStorage.tabCount = 0;
|
|
266
|
+
|
|
267
|
+
localStorage.tabCount = +localStorage.tabCount + 1;
|
|
268
|
+
}
|
|
269
|
+
const terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';
|
|
270
|
+
window.addEventListener(terminationEvent, (event) => {
|
|
271
|
+
if (localStorage.tabCount > 0) {
|
|
272
|
+
localStorage.tabCount = +localStorage.tabCount - 1;
|
|
273
|
+
}
|
|
274
|
+
}, { capture: true });
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
// param() {
|
|
280
|
+
// // PARAM
|
|
281
|
+
// const url: URL = new URL(window.top.location.href);
|
|
282
|
+
// const params: URLSearchParams = url.searchParams;
|
|
283
|
+
// return params;
|
|
284
|
+
// }
|
|
285
|
+
/**
|
|
286
|
+
*/
|
|
287
|
+
ngOnInit() {
|
|
288
|
+
const appconfig = this.appConfigProvider.getConfig();
|
|
289
|
+
this.persistence = appconfig.authPersistence;
|
|
290
|
+
this.appStorageService.initialize(environment.storage_prefix, this.persistence, '')
|
|
291
|
+
// this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
|
|
292
|
+
// this.logger.log('[APP-COMP] ngOnInit this.route.snapshot.params -->', this.route.snapshot.params);
|
|
293
|
+
// this.initializeApp('oninit');
|
|
294
|
+
const token = getParameterByName('jwt')
|
|
295
|
+
// this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
|
|
296
|
+
|
|
297
|
+
if (token) {
|
|
298
|
+
// this.isOnline = false;
|
|
299
|
+
// this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with this.isOnline ', this.isOnline)
|
|
300
|
+
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName ', token)
|
|
301
|
+
// save token in local storage then
|
|
302
|
+
|
|
303
|
+
const storedToken = this.appStorageService.getItem('tiledeskToken');
|
|
304
|
+
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN storedToken ', storedToken)
|
|
305
|
+
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN SAVE THE PARAMS TOKEN ', token)
|
|
306
|
+
if (storedToken !== token) {
|
|
307
|
+
this.appStorageService.setItem('tiledeskToken', token);
|
|
308
|
+
} else {
|
|
309
|
+
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
this.initializeApp('oninit');
|
|
315
|
+
this.listenToPostMsgs();
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
listenToPostMsgs() {
|
|
320
|
+
window.addEventListener("message", (event) => {
|
|
321
|
+
this.logger.log("[APP-COMP] message event ", event);
|
|
322
|
+
|
|
323
|
+
if (event && event.data && event.data.action && event.data.parameter) {
|
|
324
|
+
if (event.data.action === 'openJoinConversationModal') {
|
|
325
|
+
// console.log("[APP-COMP] message event action ", event.data.action);
|
|
326
|
+
// console.log("[APP-COMP] message event parameter ", event.data.parameter);
|
|
327
|
+
this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// if (event && event.data && event.data.action && event.data.parameter) {
|
|
331
|
+
// if (event.data.action === 'hasArchived') {
|
|
332
|
+
// var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
333
|
+
// const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
334
|
+
// input !== null && input.tagName === 'IFRAME';
|
|
335
|
+
// if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
336
|
+
// const msg = { action: "hasArchived", parameter: event.data.parameter, calledBy: event.data.calledBy }
|
|
337
|
+
// iframeWin.contentWindow.postMessage(msg, '*');
|
|
338
|
+
// }
|
|
339
|
+
|
|
340
|
+
// }
|
|
341
|
+
// }
|
|
342
|
+
if (event && event.data && event.data.action && event.data.text) {
|
|
343
|
+
if (event.data.action === "display_toast_join_complete") {
|
|
344
|
+
this.presentToastJoinComplete(event.data.text)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
async presentToastJoinComplete(text) {
|
|
351
|
+
const toast = await this.toastController.create({
|
|
352
|
+
message: text,
|
|
353
|
+
duration: 2000,
|
|
354
|
+
color: "success"
|
|
355
|
+
});
|
|
356
|
+
toast.present();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
async presentAlertConfirmJoinRequest(requestid, calledby) {
|
|
360
|
+
var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
361
|
+
// console.log("[APP-COMP] message event iframeWin ", iframeWin);
|
|
362
|
+
|
|
363
|
+
const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
364
|
+
input !== null && input.tagName === 'IFRAME';
|
|
365
|
+
|
|
366
|
+
const keys = ['YouAreAboutToJoinThisChat', 'Cancel', 'AreYouSure'];
|
|
367
|
+
const translationMap = this.translateService.translateLanguage(keys);
|
|
368
|
+
|
|
369
|
+
const alert = await this.alertController.create({
|
|
370
|
+
cssClass: 'my-custom-class',
|
|
371
|
+
header: translationMap.get('AreYouSure'),
|
|
372
|
+
message: translationMap.get('YouAreAboutToJoinThisChat'),
|
|
373
|
+
buttons: [
|
|
374
|
+
{
|
|
375
|
+
text: translationMap.get('Cancel'),
|
|
376
|
+
role: 'cancel',
|
|
377
|
+
cssClass: 'secondary',
|
|
378
|
+
handler: (blah) => {
|
|
379
|
+
// console.log('Confirm Cancel: blah', blah);
|
|
380
|
+
}
|
|
381
|
+
}, {
|
|
382
|
+
text: 'Ok',
|
|
383
|
+
handler: () => {
|
|
384
|
+
// console.log('Confirm Okay');
|
|
385
|
+
|
|
386
|
+
if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
387
|
+
const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
|
|
388
|
+
iframeWin.contentWindow.postMessage(msg, '*');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
await alert.present();
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
signInWithCustomToken(token) {
|
|
402
|
+
// this.isOnline = false;
|
|
403
|
+
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
|
|
404
|
+
this.tiledeskAuthService.signInWithCustomToken(token)
|
|
405
|
+
.then((user: any) => {
|
|
406
|
+
this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN AUTLOGIN user', user)
|
|
407
|
+
this.messagingAuthService.createCustomToken(token)
|
|
408
|
+
})
|
|
409
|
+
.catch(error => {
|
|
410
|
+
this.logger.error('[APP-COMP] SIGNINWITHCUSTOMTOKEN error::', error)
|
|
411
|
+
})
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** */
|
|
415
|
+
initializeApp(calledby: string) {
|
|
416
|
+
// this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
|
|
417
|
+
// console.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
|
|
418
|
+
|
|
419
|
+
// if (!this.platform.is('cordova')) {
|
|
420
|
+
this.splashScreen.show();
|
|
421
|
+
// }
|
|
422
|
+
this.tabTitle = document.title;
|
|
423
|
+
|
|
424
|
+
this.getRouteParamsAndSetLoggerConfig();
|
|
425
|
+
|
|
426
|
+
const appconfig = this.appConfigProvider.getConfig();
|
|
427
|
+
// this.logger.info('[APP-COMP] appconfig: ', appconfig)
|
|
428
|
+
this.version = PACKAGE.version;
|
|
429
|
+
this.logger.info('[APP-COMP] version: ', this.version)
|
|
430
|
+
|
|
431
|
+
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
432
|
+
this.logger.info('[APP-COMP] logLevel: ', appconfig.logLevel);
|
|
433
|
+
|
|
434
|
+
this.tenant = appconfig.firebaseConfig.tenant;
|
|
435
|
+
this.logger.info('[APP-COMP] appconfig firebaseConfig tenant: ', this.tenant);
|
|
65
436
|
this.notificationsEnabled = true;
|
|
66
|
-
this.zone = new NgZone({});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!appConfigProvider.getConfig().firebaseConfig || appConfigProvider.getConfig().firebaseConfig.apiKey === 'CHANGEIT') {
|
|
81
|
-
// tslint:disable-next-line:max-line-length
|
|
82
|
-
throw new Error('firebase config is not defined. Please create your firebase-config.json. See the Chat21-Web_widget Installation Page');
|
|
83
|
-
}
|
|
84
|
-
firebase.initializeApp(appConfigProvider.getConfig().firebaseConfig); // here shows the error
|
|
85
|
-
console.log('firebase', firebase);
|
|
86
|
-
|
|
87
|
-
platform.ready().then(() => {
|
|
88
|
-
this.events.subscribe('requestPermission', this.callbackRequestPermission);
|
|
89
|
-
// Okay, so the platform is ready and our plugins are available.
|
|
90
|
-
// Here you can do any higher level native things you might need.
|
|
91
|
-
statusBar.styleDefault();
|
|
92
|
-
splashScreen.hide();
|
|
93
|
-
|
|
94
|
-
// alert(" navProxy.masterNav: ");
|
|
95
|
-
// Add our nav controllers to
|
|
96
|
-
// the nav proxy service...
|
|
97
|
-
navProxy.masterNav = this.masterNav;
|
|
98
|
-
navProxy.detailNav = this.detailNav;
|
|
99
|
-
this.masterNav.setRoot(ListaConversazioniPage, { detailNavCtrl: this.detailNav });
|
|
100
|
-
// this.detailNav.setRoot(PlaceholderPage);
|
|
101
|
-
this.msgService.initMessage();
|
|
102
|
-
this.msgService.getPermission();
|
|
103
|
-
// set tenant
|
|
104
|
-
let appConfig = config.get("appConfig");
|
|
105
|
-
const tenant = appConfig.tenant;
|
|
106
|
-
// init chat manager
|
|
107
|
-
this.chatManager.configureWithAppId(tenant);
|
|
108
|
-
|
|
109
|
-
// const language = document.documentElement.lang;
|
|
110
|
-
// let language = window.navigator.language; // detect browser language
|
|
111
|
-
// if (language == null || language == undefined) {
|
|
112
|
-
// language = "en";
|
|
437
|
+
this.zone = new NgZone({}); // a cosa serve?
|
|
438
|
+
|
|
439
|
+
// ------------------------------------------
|
|
440
|
+
// Platform ready
|
|
441
|
+
// ------------------------------------------
|
|
442
|
+
this.platform.ready().then(() => {
|
|
443
|
+
// console.log("Check platform");
|
|
444
|
+
this.getPlatformName();
|
|
445
|
+
|
|
446
|
+
this.setLanguage();
|
|
447
|
+
|
|
448
|
+
// if (this.splashScreen) {
|
|
449
|
+
this.splashScreen.hide();
|
|
113
450
|
// }
|
|
114
|
-
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
451
|
+
this.statusBar.styleDefault();
|
|
452
|
+
this.navService.init(this.sidebarNav, this.detailNav);
|
|
453
|
+
// this.persistence = appconfig.authPersistence;
|
|
454
|
+
// this.appStorageService.initialize(environment.storage_prefix, this.persistence, '')
|
|
455
|
+
this.tiledeskAuthService.initialize(this.appConfigProvider.getConfig().apiUrl);
|
|
456
|
+
this.messagingAuthService.initialize();
|
|
457
|
+
|
|
458
|
+
// this.currentUserService.initialize();
|
|
459
|
+
this.chatManager.initialize();
|
|
460
|
+
this.presenceService.initialize(this.tenant);
|
|
461
|
+
this.typingService.initialize(this.tenant);
|
|
462
|
+
|
|
463
|
+
const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
464
|
+
const vap_id_Key = this.appConfigProvider.getConfig().firebaseConfig.vapidKey
|
|
465
|
+
|
|
466
|
+
if (pushEngine && pushEngine !== 'none') {
|
|
467
|
+
this.notificationsService.initialize(this.tenant, vap_id_Key)
|
|
468
|
+
}
|
|
469
|
+
this.uploadService.initialize();
|
|
470
|
+
|
|
471
|
+
this.initAuthentication();
|
|
472
|
+
this.initSubscriptions();
|
|
473
|
+
this.initAudio();
|
|
474
|
+
|
|
475
|
+
this.logger.debug('[APP-COMP] initializeApp:: ', this.sidebarNav, this.detailNav);
|
|
476
|
+
|
|
477
|
+
this.translateToastMsgs();
|
|
478
|
+
|
|
479
|
+
// ---------------------------------------
|
|
480
|
+
// Watch to network status
|
|
481
|
+
// ---------------------------------------
|
|
482
|
+
this.watchToConnectionStatus();
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
getPlatformName() {
|
|
487
|
+
if (this.platform.is('cordova')) {
|
|
488
|
+
this.logger.log("the device running Cordova");
|
|
489
|
+
}
|
|
490
|
+
if (!this.platform.is('cordova')) {
|
|
491
|
+
this.logger.log("the device Not running Cordova");
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (this.platform.is('android')) {
|
|
495
|
+
this.logger.log("running on Android device!");
|
|
496
|
+
}
|
|
497
|
+
if (this.platform.is('ios')) {
|
|
498
|
+
this.logger.log("running on iOS device!");
|
|
499
|
+
}
|
|
500
|
+
if (this.platform.is('mobileweb')) {
|
|
501
|
+
this.logger.log("running in a browser on mobile!");
|
|
502
|
+
}
|
|
503
|
+
if (this.platform.is('desktop')) {
|
|
504
|
+
this.logger.log("running on desktop!");
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
getRouteParamsAndSetLoggerConfig() {
|
|
510
|
+
const appconfig = this.appConfigProvider.getConfig();
|
|
511
|
+
this.route.queryParams.subscribe(params => {
|
|
512
|
+
// this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
|
|
513
|
+
if (params.logLevel) {
|
|
514
|
+
this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
|
|
515
|
+
this.logger.setLoggerConfig(true, params.logLevel)
|
|
124
516
|
} else {
|
|
125
|
-
|
|
517
|
+
this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from appconfig: ', appconfig.logLevel)
|
|
518
|
+
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
126
519
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/** */
|
|
524
|
+
setLanguage() {
|
|
525
|
+
this.translate.setDefaultLang('en');
|
|
526
|
+
this.translate.use('en');
|
|
527
|
+
this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
|
|
528
|
+
let language;
|
|
529
|
+
if (navigator.language.indexOf('-') !== -1) {
|
|
530
|
+
language = navigator.language.substring(0, navigator.language.indexOf('-'));
|
|
531
|
+
} else if (navigator.language.indexOf('_') !== -1) {
|
|
532
|
+
language = navigator.language.substring(0, navigator.language.indexOf('_'));
|
|
533
|
+
} else {
|
|
534
|
+
language = navigator.language;
|
|
535
|
+
}
|
|
536
|
+
this.translate.use(language);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
watchToConnectionStatus() {
|
|
541
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
542
|
+
this.checkInternet = isOnline
|
|
543
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
130
544
|
|
|
545
|
+
// checking internet connection
|
|
546
|
+
if (this.checkInternet == true) {
|
|
547
|
+
// this.events.publish('internetisonline', true);
|
|
548
|
+
// show success alert if internet is working
|
|
549
|
+
// alert('Internet is working.')
|
|
550
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - Internet is working.')
|
|
551
|
+
// this.logger.log('[APP-COMP] - watchToConnectionStatus - this.missingConnectionToast', this.missingConnectionToast)
|
|
552
|
+
if (!checkPlatformIsMobile()) {
|
|
553
|
+
const elemIonNav = <HTMLElement>document.querySelector('ion-nav');
|
|
554
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - desktop * elemIonNav *', elemIonNav)
|
|
555
|
+
|
|
556
|
+
if (this.executedInitializeAppByWatchConnection === false) {
|
|
557
|
+
setTimeout(() => {
|
|
558
|
+
const elemIonNavchildNodes = elemIonNav.childNodes;
|
|
559
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - elemIonNavchildNodes ', elemIonNavchildNodes);
|
|
560
|
+
|
|
561
|
+
if (elemIonNavchildNodes.length === 0) {
|
|
562
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - elemIonNavchildNodes HERE YES', elemIonNavchildNodes);
|
|
563
|
+
|
|
564
|
+
// this.initializeApp('checkinternet');
|
|
565
|
+
this.executedInitializeAppByWatchConnection = true;
|
|
566
|
+
}
|
|
567
|
+
}, 2000);
|
|
568
|
+
}
|
|
569
|
+
} else if (checkPlatformIsMobile()) {
|
|
570
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile ')
|
|
571
|
+
const elemIonRouterOutlet = <HTMLElement>document.querySelector('ion-router-outlet');
|
|
572
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile * elemIonRouterOutlet *', elemIonRouterOutlet)
|
|
573
|
+
if (this.executedInitializeAppByWatchConnection === false) {
|
|
574
|
+
setTimeout(() => {
|
|
575
|
+
const childElementCount = elemIonRouterOutlet.childElementCount;
|
|
576
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile * childElementCount *', childElementCount)
|
|
577
|
+
if (childElementCount === 1) {
|
|
578
|
+
// this.initializeApp('checkinternet');
|
|
579
|
+
this.executedInitializeAppByWatchConnection = true;
|
|
580
|
+
}
|
|
581
|
+
}, 2000);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - Internet is slow or not working.');
|
|
587
|
+
}
|
|
131
588
|
});
|
|
589
|
+
}
|
|
132
590
|
|
|
133
|
-
// // solve the issue : "Cannot read property 'myID' of undefined"
|
|
134
|
-
// // source :
|
|
135
|
-
// // https://github.com/firebase/angularfire/issues/970
|
|
136
|
-
// if (getLocalStorage()) {
|
|
137
|
-
// getLocalStorage().removeItem('firebase:previous_websocket_failure');
|
|
138
|
-
// }
|
|
139
591
|
|
|
140
|
-
|
|
592
|
+
translateToastMsgs() {
|
|
593
|
+
this.translate.get('AnErrorOccurredWhileUnsubscribingFromNotifications')
|
|
594
|
+
.subscribe((text: string) => {
|
|
595
|
+
this.toastMsgErrorWhileUnsubscribingFromNotifications = text;
|
|
596
|
+
});
|
|
597
|
+
this.translate.get('CLOSE_TOAST')
|
|
598
|
+
.subscribe((text: string) => {
|
|
599
|
+
this.toastMsgCloseToast = text;
|
|
600
|
+
});
|
|
601
|
+
this.translate.get('WAITING_FOR_NETWORK')
|
|
602
|
+
.subscribe((text: string) => {
|
|
603
|
+
this.toastMsgWaitingForNetwork = text;
|
|
604
|
+
});
|
|
141
605
|
}
|
|
142
606
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
607
|
+
|
|
608
|
+
/***************************************************+*/
|
|
609
|
+
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
610
|
+
private initAuthentication() {
|
|
611
|
+
const tiledeskToken = this.appStorageService.getItem('tiledeskToken')
|
|
612
|
+
|
|
613
|
+
this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
|
|
614
|
+
this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
|
|
615
|
+
// const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
616
|
+
// this.logger.log('[APP-COMP] >>> initAuthentication currentUser ', currentUser)
|
|
617
|
+
if (tiledeskToken) {
|
|
618
|
+
this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
|
|
619
|
+
this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
|
|
620
|
+
this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
|
|
621
|
+
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
622
|
+
}).catch(error => {
|
|
623
|
+
this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
|
|
624
|
+
})
|
|
625
|
+
} else {
|
|
626
|
+
this.logger.warn('[APP-COMP] >>> I AM NOT LOGGED IN <<<')
|
|
627
|
+
|
|
628
|
+
// clearTimeout(this.timeModalLogin);
|
|
629
|
+
// this.timeModalLogin = setTimeout(() => {
|
|
630
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
631
|
+
this.authModal = this.presentModal('initAuthentication');
|
|
632
|
+
this.hadBeenCalledOpenModal = true;
|
|
633
|
+
}
|
|
634
|
+
// }, 1000);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// checkTokenAndGoOffline() {
|
|
639
|
+
// let token = this.appStorageService.getItem('tiledeskToken');
|
|
640
|
+
// this.logger.info('[APP-COMP] ***** checkTokenAndGoOffline - stored token *****', token);
|
|
641
|
+
// if (!token) {
|
|
642
|
+
// this.goOffLine()
|
|
643
|
+
// }
|
|
644
|
+
// }
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
/**------- AUTHENTICATION FUNCTIONS --> END <--- +*/
|
|
648
|
+
/***************************************************+*/
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
checkPlatform() {
|
|
653
|
+
// console.log('[APP-COMP] checkPlatform');
|
|
654
|
+
// let pageUrl = '';
|
|
655
|
+
// try {
|
|
656
|
+
// const pathPage = this.route.snapshot.firstChild.routeConfig.path;
|
|
657
|
+
// this.route.snapshot.firstChild.url.forEach(element => {
|
|
658
|
+
// pageUrl += '/' + element.path;
|
|
659
|
+
// });
|
|
660
|
+
// } catch (error) {
|
|
661
|
+
// this.logger.debug('error', error);
|
|
662
|
+
// }
|
|
663
|
+
// this.logger.debug('checkPlatform pathPage: ', pageUrl);
|
|
664
|
+
// if (!pageUrl || pageUrl === '') {
|
|
665
|
+
// pageUrl = '/conversations-list';
|
|
666
|
+
// }
|
|
667
|
+
|
|
668
|
+
if (checkPlatformIsMobile()) {
|
|
669
|
+
this.chatManager.startApp();
|
|
670
|
+
|
|
671
|
+
this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
|
|
672
|
+
this.platformIs = PLATFORM_MOBILE;
|
|
673
|
+
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
674
|
+
|
|
675
|
+
// console.log('[APP-COMP] platformIs', this.platformIs);
|
|
676
|
+
// console.log('[APP-COMP] PLATFORM', PLATFORM_MOBILE, 'route.snapshot', this.route.snapshot);
|
|
677
|
+
if (!IDConv) {
|
|
678
|
+
this.router.navigateByUrl('conversations-list')
|
|
679
|
+
}
|
|
680
|
+
// this.router.navigateByUrl(pageUrl);
|
|
681
|
+
// this.navService.setRoot(ConversationListPage, {});
|
|
682
|
+
} else {
|
|
683
|
+
this.chatManager.startApp();
|
|
684
|
+
this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
|
|
685
|
+
this.platformIs = PLATFORM_DESKTOP;
|
|
686
|
+
// console.log('[APP-COMP] platformIs', this.platformIs);
|
|
687
|
+
// console.log('[APP-COMP] PLATFORM', PLATFORM_DESKTOP, 'route.snapshot', this.route.snapshot);
|
|
688
|
+
this.logger.log('[APP-COMP] PLATFORM_DESKTOP ', this.navService);
|
|
689
|
+
|
|
690
|
+
this.navService.setRoot(ConversationListPage, {});
|
|
691
|
+
|
|
692
|
+
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
693
|
+
|
|
694
|
+
const FullNameConv = this.route.snapshot.firstChild.paramMap.get('FullNameConv');
|
|
695
|
+
const Convtype = this.route.snapshot.firstChild.paramMap.get('Convtype');
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
let pageUrl = 'conversation-detail/'
|
|
699
|
+
if (IDConv && FullNameConv) {
|
|
700
|
+
pageUrl += IDConv + '/' + FullNameConv + '/' + Convtype
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
this.router.navigateByUrl(pageUrl);
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
// const DASHBOARD_URL = this.appConfigProvider.getConfig().DASHBOARD_URL;
|
|
707
|
+
// createExternalSidebar(this.renderer, DASHBOARD_URL);
|
|
708
|
+
|
|
709
|
+
// // FOR REALTIME TESTING
|
|
710
|
+
// createExternalSidebar(this.renderer, 'http://localhost:4204');
|
|
711
|
+
|
|
712
|
+
}
|
|
147
713
|
}
|
|
148
|
-
|
|
149
|
-
|
|
714
|
+
|
|
715
|
+
/** */
|
|
716
|
+
// showNavbar() {
|
|
717
|
+
// let TEMP = location.search.split('navBar=')[1];
|
|
718
|
+
// if (TEMP) { this.isNavBar = TEMP.split('&')[0]; }
|
|
719
|
+
// }
|
|
720
|
+
|
|
721
|
+
/** */
|
|
722
|
+
hideAlert() {
|
|
723
|
+
this.logger.debug('[APP-COMP] hideAlert');
|
|
150
724
|
this.notificationsEnabled = true;
|
|
151
725
|
}
|
|
152
726
|
|
|
153
|
-
|
|
727
|
+
private initAudio() {
|
|
728
|
+
// console.log('HERE IS initAudio ')
|
|
729
|
+
// SET AUDIO
|
|
730
|
+
const href = window.location.href;
|
|
731
|
+
const hrefArray = href.split('/#/');
|
|
732
|
+
const chatBaseUrl = hrefArray[0]
|
|
733
|
+
// console.log('initAudio href', href)
|
|
734
|
+
// console.log('initAudio chatBaseUrl', chatBaseUrl)
|
|
735
|
+
|
|
736
|
+
this.audio = new Audio();
|
|
737
|
+
this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
|
|
738
|
+
this.audio.load();
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
private manageTabNotification() {
|
|
742
|
+
if (!this.isTabVisible) {
|
|
743
|
+
// TAB IS HIDDEN --> manage title and SOUND
|
|
744
|
+
// console.log('HERE IS manageTabNotification ')
|
|
745
|
+
let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
|
|
746
|
+
badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
|
|
747
|
+
document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
|
|
748
|
+
|
|
749
|
+
clearInterval(this.setIntervalTime)
|
|
750
|
+
const that = this
|
|
751
|
+
this.setIntervalTime = setInterval(function () {
|
|
752
|
+
if (document.title.charAt(0) === '(') {
|
|
753
|
+
document.title = that.tabTitle
|
|
754
|
+
} else {
|
|
755
|
+
document.title = "(" + badgeNewConverstionNumber + ") " + that.tabTitle;
|
|
756
|
+
}
|
|
757
|
+
}, 1000);
|
|
758
|
+
this.soundMessage()
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
soundMessage() {
|
|
763
|
+
// console.log('HERE IS soundMessage ')
|
|
764
|
+
const that = this;
|
|
765
|
+
// this.audio = new Audio();
|
|
766
|
+
// // this.audio.src = '/assets/sounds/pling.mp3';
|
|
767
|
+
// this.audio.src = URL_SOUND_LIST_CONVERSATION;
|
|
768
|
+
// this.audio.load();
|
|
769
|
+
this.logger.debug('[APP-COMP] conversation play', this.audio);
|
|
770
|
+
clearTimeout(this.setTimeoutSound);
|
|
771
|
+
this.setTimeoutSound = setTimeout(function () {
|
|
772
|
+
that.audio.play().then(() => {
|
|
773
|
+
that.logger.debug('[APP-COMP] ****** soundMessage played *****');
|
|
774
|
+
}).catch((error: any) => {
|
|
775
|
+
that.logger.error('[APP-COMP] ***soundMessage error*', error);
|
|
776
|
+
});
|
|
777
|
+
}, 1000);
|
|
778
|
+
}
|
|
779
|
+
/**---------------- SOUND FUNCTIONS --> END <--- +*/
|
|
780
|
+
/***************************************************+*/
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
// BEGIN SUBSCRIPTIONS //
|
|
784
|
+
/** .pipe(
|
|
785
|
+
takeUntil(this.unsubscribe$)
|
|
786
|
+
) */
|
|
787
|
+
initSubscriptions() {
|
|
788
|
+
this.logger.log('initialize FROM [APP-COMP] - initSubscriptions');
|
|
789
|
+
|
|
790
|
+
// ---------------------------------------------------------------------------------------------------
|
|
791
|
+
// Protecting from multiple subsciptions due to multiple app initializations (call to initializeApp())
|
|
792
|
+
// Only one subscriber x application allowed
|
|
793
|
+
// ---------------------------------------------------------------------------------------------------
|
|
794
|
+
if (this.BSAuthStateChangedSubscriptionRef) {
|
|
795
|
+
this.logger.log('initialize FROM [APP-COMP] - BSAuthStateChanged ALREADY SUBSCRIBED');
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
|
|
154
800
|
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
|
|
801
|
+
// .pipe(takeUntil(this.unsubscribe$))
|
|
802
|
+
.pipe(filter((state) => state !== null))
|
|
803
|
+
.subscribe((state: any) => {
|
|
804
|
+
this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
|
|
805
|
+
|
|
806
|
+
if (state && state === AUTH_STATE_ONLINE) {
|
|
807
|
+
// const user = this.tiledeskAuthService.getCurrentUser();
|
|
808
|
+
// if (this.isOnline === false) {
|
|
809
|
+
// if (AUTH_STATE_ONLINE) {
|
|
810
|
+
this.goOnLine();
|
|
811
|
+
// }
|
|
812
|
+
} else if (state === AUTH_STATE_OFFLINE) {
|
|
813
|
+
// this.checkTokenAndGoOffline() //se c'è un tiledeskToken salvato, allora aspetta, altrimenti vai offline
|
|
814
|
+
this.goOffLine()
|
|
815
|
+
}
|
|
816
|
+
}, error => {
|
|
817
|
+
this.logger.error('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged * error * ', error)
|
|
818
|
+
}, () => {
|
|
819
|
+
this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged *** complete *** ')
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
this.events.subscribe('uidConvSelected:changed', this.subscribeChangedConversationSelected);
|
|
824
|
+
this.events.subscribe('profileInfoButtonClick:logout', this.subscribeProfileInfoButtonLogOut);
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
828
|
+
// this.logger.log('[APP-COMP] ***** conversationsAdded *****', conversation);
|
|
829
|
+
// that.conversationsChanged(conversations);
|
|
830
|
+
if (conversation && conversation.is_new === true) {
|
|
831
|
+
this.manageTabNotification()
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
836
|
+
|
|
837
|
+
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
838
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
839
|
+
this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user: ', currentUser);
|
|
840
|
+
|
|
841
|
+
if (currentUser) {
|
|
842
|
+
this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
|
|
843
|
+
if (conversation && conversation.sender !== currentUser.uid) {
|
|
844
|
+
this.manageTabNotification();
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* goOnLine:
|
|
852
|
+
* 1 - nascondo splashscreen
|
|
853
|
+
* 2 - recupero il tiledeskToken e lo salvo in chat manager
|
|
854
|
+
* 3 - carico in d
|
|
855
|
+
* @param user
|
|
856
|
+
*/
|
|
857
|
+
goOnLine = () => {
|
|
858
|
+
this.logger.log('[APP-COMP]- GO-ONLINE ');
|
|
859
|
+
// this.isOnline = true;
|
|
860
|
+
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
|
|
861
|
+
// clearTimeout(this.timeModalLogin);
|
|
862
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
863
|
+
|
|
864
|
+
// const supportmode = this.appConfigProvider.getConfig().supportMode;
|
|
865
|
+
// this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
|
|
866
|
+
// if (supportmode === true) {
|
|
867
|
+
// this.connetWebsocket() // moved in the comp project-item
|
|
868
|
+
// }
|
|
869
|
+
this.events.publish('go:online', true);
|
|
870
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
871
|
+
// this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
|
|
872
|
+
this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
|
|
873
|
+
this.chatManager.setTiledeskToken(tiledeskToken);
|
|
874
|
+
this.chatManager.setCurrentUser(currentUser);
|
|
875
|
+
// this.chatManager.startApp();
|
|
876
|
+
|
|
877
|
+
// ----------------------------------------------
|
|
878
|
+
// PUSH NOTIFICATIONS
|
|
879
|
+
// ----------------------------------------------
|
|
880
|
+
const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
881
|
+
|
|
882
|
+
if (currentUser) {
|
|
883
|
+
if (pushEngine && pushEngine !== 'none') {
|
|
884
|
+
this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
|
|
885
|
+
}
|
|
886
|
+
this.presenceService.setPresence(currentUser.uid);
|
|
887
|
+
|
|
888
|
+
this.initConversationsHandler(currentUser.uid);
|
|
889
|
+
this.initArchivedConversationsHandler(currentUser.uid);
|
|
890
|
+
}
|
|
891
|
+
this.checkPlatform();
|
|
892
|
+
try {
|
|
893
|
+
this.logger.debug('[APP-COMP] ************** closeModal', this.authModal);
|
|
894
|
+
if (this.authModal) {
|
|
895
|
+
this.closeModal();
|
|
896
|
+
}
|
|
897
|
+
} catch (err) {
|
|
898
|
+
this.logger.error('[APP-COMP] -> error:', err);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
goOffLine = () => {
|
|
906
|
+
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
907
|
+
const supportmode = this.appConfigProvider.getConfig().supportMode;
|
|
908
|
+
this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
|
|
909
|
+
if (supportmode === true) {
|
|
910
|
+
this.webSocketClose()
|
|
911
|
+
}
|
|
912
|
+
// this.isOnline = false;
|
|
913
|
+
// this.conversationsHandlerService.conversations = [];
|
|
914
|
+
this.chatManager.setTiledeskToken(null);
|
|
915
|
+
this.chatManager.setCurrentUser(null);
|
|
916
|
+
this.chatManager.goOffLine();
|
|
917
|
+
|
|
918
|
+
this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
|
|
919
|
+
|
|
920
|
+
// clearTimeout(this.timeModalLogin);
|
|
921
|
+
// this.timeModalLogin = setTimeout(() => {
|
|
922
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
923
|
+
this.authModal = this.presentModal('goOffLine');
|
|
924
|
+
this.hadBeenCalledOpenModal = true
|
|
925
|
+
}
|
|
926
|
+
// }, 1000);
|
|
927
|
+
|
|
928
|
+
// this.unsubscribe$.next();
|
|
929
|
+
// this.unsubscribe$.complete();
|
|
930
|
+
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
webSocketClose() {
|
|
935
|
+
this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
|
|
936
|
+
this.webSocketJs.close()
|
|
937
|
+
this.events.publish('go:offline', true);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// BEGIN RESIZE FUNCTIONS //
|
|
941
|
+
@HostListener('window:resize', ['$event'])
|
|
942
|
+
onResize(event: any) {
|
|
943
|
+
const that = this;
|
|
944
|
+
// this.logger.debug('this.doitResize)', this.doitResize)
|
|
945
|
+
// clearTimeout(this.doitResize);
|
|
946
|
+
// this.doitResize = setTimeout(() => {
|
|
947
|
+
let platformIsNow = PLATFORM_DESKTOP;
|
|
948
|
+
if (checkPlatformIsMobile()) {
|
|
949
|
+
platformIsNow = PLATFORM_MOBILE;
|
|
950
|
+
}
|
|
951
|
+
if (!this.platformIs || this.platformIs === '') {
|
|
952
|
+
this.platformIs = platformIsNow;
|
|
953
|
+
}
|
|
954
|
+
this.logger.debug('[APP-COMP] onResize width::::', window.innerWidth);
|
|
955
|
+
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
|
|
956
|
+
this.logger.debug('[APP-COMP] onResize width:::: this.platformIs', this.platformIs);
|
|
957
|
+
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
|
|
958
|
+
if (platformIsNow !== this.platformIs) {
|
|
959
|
+
window.location.reload();
|
|
960
|
+
// this.checkPlatform();
|
|
961
|
+
// this.initializeApp('onresize')
|
|
962
|
+
this.checkPlatform();
|
|
963
|
+
// this.goOnLine()
|
|
964
|
+
// // this.initSubscriptions();
|
|
965
|
+
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// }, 0);
|
|
969
|
+
}
|
|
970
|
+
// END RESIZE FUNCTIONS //
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* ::: subscribeChangedConversationSelected :::
|
|
974
|
+
* evento richiamato quando si seleziona un utente nell'elenco degli user
|
|
975
|
+
* apro dettaglio conversazione
|
|
976
|
+
*/
|
|
977
|
+
subscribeChangedConversationSelected = (user: UserModel, type: string) => {
|
|
978
|
+
this.logger.log('[APP-COMP] subscribeUidConvSelectedChanged navigateByUrl', user, type);
|
|
979
|
+
// this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
|
|
980
|
+
this.router.navigateByUrl('conversation-detail/' + user.uid + '/' + user.fullname + '/' + type);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
subscribeProfileInfoButtonLogOut = (hasClickedLogout) => {
|
|
984
|
+
this.logger.log('[APP-COMP] FIREBASE-NOTIFICATION >>>> subscribeProfileInfoButtonLogOut ');
|
|
985
|
+
// if (hasClickedLogout === true) {
|
|
986
|
+
// this.removePresenceAndLogout()
|
|
987
|
+
// }
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
if (hasClickedLogout === true) {
|
|
991
|
+
// ----------------------------------------------
|
|
992
|
+
// PUSH NOTIFICATIONS
|
|
993
|
+
// ----------------------------------------------
|
|
994
|
+
const that = this;
|
|
995
|
+
const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
996
|
+
if (pushEngine && pushEngine !== 'none') {
|
|
997
|
+
this.notificationsService.removeNotificationsInstance(function (res) {
|
|
998
|
+
that.logger.log('[APP-COMP] FIREBASE-NOTIFICATION >>>> removeNotificationsInstance > CALLBACK RES', res);
|
|
999
|
+
|
|
1000
|
+
if (res === 'success') {
|
|
1001
|
+
that.removePresenceAndLogout();
|
|
1002
|
+
} else {
|
|
1003
|
+
that.removePresenceAndLogout();
|
|
1004
|
+
// that.presentToast();
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
private async presentModal(calledby): Promise<any> {
|
|
1012
|
+
this.logger.log('[APP-COMP] presentModal calledby', calledby, '- hadBeenCalledOpenModal: ', this.hadBeenCalledOpenModal);
|
|
1013
|
+
const attributes = { tenant: this.tenant, enableBackdropDismiss: false };
|
|
1014
|
+
const modal: HTMLIonModalElement =
|
|
1015
|
+
await this.modalController.create({
|
|
1016
|
+
component: LoginPage,
|
|
1017
|
+
componentProps: attributes,
|
|
1018
|
+
swipeToClose: false,
|
|
1019
|
+
backdropDismiss: false
|
|
1020
|
+
});
|
|
1021
|
+
modal.onDidDismiss().then((detail: any) => {
|
|
1022
|
+
this.hadBeenCalledOpenModal = false
|
|
1023
|
+
this.logger.log('[APP-COMP] presentModal onDidDismiss detail.data ', detail.data);
|
|
1024
|
+
// this.checkPlatform();
|
|
1025
|
+
if (detail !== null) {
|
|
1026
|
+
// this.logger.debug('The result: CHIUDI!!!!!', detail.data);
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
// await modal.present();
|
|
1030
|
+
// modal.onDidDismiss().then((detail: any) => {
|
|
1031
|
+
// this.logger.debug('The result: CHIUDI!!!!!', detail.data);
|
|
1032
|
+
// // this.checkPlatform();
|
|
1033
|
+
// if (detail !== null) {
|
|
1034
|
+
// // this.logger.debug('The result: CHIUDI!!!!!', detail.data);
|
|
1035
|
+
// }
|
|
1036
|
+
// });
|
|
1037
|
+
return await modal.present();
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
private async closeModal() {
|
|
1041
|
+
this.logger.debug('[APP-COMP] closeModal', this.modalController);
|
|
1042
|
+
this.logger.debug('[APP-COMP] closeModal .getTop()', this.modalController.getTop());
|
|
1043
|
+
await this.modalController.getTop();
|
|
1044
|
+
this.modalController.dismiss({ confirmed: true });
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
// listenToLogoutEvent() {
|
|
1049
|
+
// this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
|
|
1050
|
+
// this.logger.debug('[APP-COMP] hasclickedlogout', hasclickedlogout);
|
|
1051
|
+
// if (hasclickedlogout === true) {
|
|
1052
|
+
// // ----------------------------------------------
|
|
1053
|
+
// // PUSH NOTIFICATIONS
|
|
1054
|
+
// // ----------------------------------------------
|
|
1055
|
+
// const that = this;
|
|
1056
|
+
// const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
1057
|
+
// if( pushEngine && pushEngine !== 'none'){
|
|
1058
|
+
// this.notificationsService.removeNotificationsInstance(function (res) {
|
|
1059
|
+
// that.logger.debug('[APP-COMP] FIREBASE-NOTIFICATION >>>> removeNotificationsInstance > CALLBACK RES', res);
|
|
1060
|
+
|
|
1061
|
+
// if (res === 'success') {
|
|
1062
|
+
// that.removePresenceAndLogout();
|
|
1063
|
+
// } else {
|
|
1064
|
+
// that.removePresenceAndLogout();
|
|
1065
|
+
// that.presentToast();
|
|
1066
|
+
// }
|
|
1067
|
+
// })
|
|
1068
|
+
// }
|
|
1069
|
+
|
|
1070
|
+
// }
|
|
1071
|
+
// });
|
|
1072
|
+
// }
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
async presentToast() {
|
|
1076
|
+
const toast = await this.toastController.create({
|
|
1077
|
+
message: this.toastMsgErrorWhileUnsubscribingFromNotifications,
|
|
1078
|
+
duration: 2000
|
|
1079
|
+
});
|
|
1080
|
+
toast.present();
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
removePresenceAndLogout() {
|
|
1084
|
+
this.logger.debug('[APP-COMP] FIREBASE-NOTIFICATION >>>> calling removePresenceAndLogout');
|
|
1085
|
+
this.presenceService.removePresence();
|
|
1086
|
+
this.tiledeskAuthService.logOut()
|
|
1087
|
+
this.messagingAuthService.logout()
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
private initConversationsHandler(userId: string) {
|
|
1091
|
+
const keys = ['YOU'];
|
|
1092
|
+
const translationMap = this.translateService.translateLanguage(keys);
|
|
1093
|
+
|
|
1094
|
+
this.logger.log('[APP-COMP] initConversationsHandler ------------->', userId, this.tenant);
|
|
1095
|
+
// 1 - init chatConversationsHandler and archviedConversationsHandler
|
|
1096
|
+
this.conversationsHandlerService.initialize(this.tenant, userId, translationMap);
|
|
1097
|
+
|
|
1098
|
+
// this.subscribeToConvs()
|
|
1099
|
+
this.conversationsHandlerService.subscribeToConversations(() => {
|
|
1100
|
+
this.logger.log('[APP-COMP] - CONVS - INIT CONV')
|
|
1101
|
+
|
|
1102
|
+
const conversations = this.conversationsHandlerService.conversations;
|
|
1103
|
+
this.logger.info('initialize FROM [APP-COMP] - [APP-COMP]-CONVS - INIT CONV CONVS', conversations)
|
|
1104
|
+
|
|
1105
|
+
// this.logger.printDebug('SubscribeToConversations (convs-list-page) - conversations')
|
|
1106
|
+
if (!conversations || conversations.length === 0) {
|
|
1107
|
+
// that.showPlaceholder = true;
|
|
1108
|
+
this.logger.debug('[APP-COMP]-CONVS - INIT CONV CONVS 2', conversations)
|
|
1109
|
+
this.events.publish('appcompSubscribeToConvs:loadingIsActive', false);
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
private initArchivedConversationsHandler(userId: string) {
|
|
1116
|
+
const keys = ['YOU'];
|
|
1117
|
+
|
|
1118
|
+
const translationMap = this.translateService.translateLanguage(keys);
|
|
1119
|
+
|
|
1120
|
+
this.logger.debug('[APP-COMP] initArchivedConversationsHandler ------------->', userId, this.tenant);
|
|
1121
|
+
// 1 - init archviedConversationsHandler
|
|
1122
|
+
this.archivedConversationsHandlerService.initialize(this.tenant, userId, translationMap);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
@HostListener('document:visibilitychange', [])
|
|
1127
|
+
visibilitychange() {
|
|
1128
|
+
// this.logger.debug("document TITLE", document.hidden, document.title);
|
|
1129
|
+
if (document.hidden) {
|
|
1130
|
+
this.isTabVisible = false
|
|
1131
|
+
} else {
|
|
1132
|
+
// TAB IS ACTIVE --> restore title and DO NOT SOUND
|
|
1133
|
+
clearInterval(this.setIntervalTime)
|
|
1134
|
+
this.isTabVisible = true;
|
|
1135
|
+
document.title = this.tabTitle;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// Storage event not firing: This won't work on the same page that is making the changes
|
|
1140
|
+
// https://stackoverflow.com/questions/35865481/storage-event-not-firing
|
|
1141
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
|
|
1142
|
+
@HostListener('window:storage', ['$event'])
|
|
1143
|
+
onStorageChanged(event: any) {
|
|
1144
|
+
|
|
1145
|
+
if (event.key !== 'chat_sv5__tiledeskToken') {
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
if (this.appStorageService.getItem('tiledeskToken') === null) {
|
|
1150
|
+
// console.log('[APP-COMP] - onStorageChanged tiledeskToken is null - RUN LOGOUT')
|
|
1151
|
+
this.tiledeskAuthService.logOut()
|
|
1152
|
+
this.messagingAuthService.logout();
|
|
1153
|
+
this.events.publish('profileInfoButtonClick:logout', true);
|
|
1154
|
+
// this.isOnline = false;
|
|
1155
|
+
}
|
|
1156
|
+
else {
|
|
1157
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
1158
|
+
// console.log('[APP-COMP] - X - onStorageChanged currentUser', currentUser)
|
|
1159
|
+
|
|
1160
|
+
const currentToken = this.tiledeskAuthService.getTiledeskToken();
|
|
1161
|
+
// console.log('[APP-COMP] - onStorageChanged currentToken', currentToken)
|
|
1162
|
+
if (this.appStorageService.getItem('tiledeskToken') !== null && currentToken !== this.appStorageService.getItem('tiledeskToken')) {
|
|
1163
|
+
|
|
1164
|
+
// console.log('[APP-COMP] - onStorageChanged wentOnline 2')
|
|
1165
|
+
// DEALLOCO RISORSE OCCUPATE
|
|
1166
|
+
this.messagingAuthService.logout();
|
|
1167
|
+
this.appStorageService.removeItem('currentUser')
|
|
1168
|
+
this.tiledeskAuthService.setCurrentUser(null);
|
|
1169
|
+
// this.unsubscribe$.next();
|
|
1170
|
+
// this.unsubscribe$.complete();
|
|
1171
|
+
this.initializeApp('onstoragechanged');
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
// console.log('[APP-COMP] onAuthStateChanged HERE !!! ')
|
|
1176
|
+
// firebase.auth().onAuthStateChanged(user => {
|
|
1177
|
+
// console.log('[APP-COMP] onAuthStateChanged', user)
|
|
1178
|
+
// })
|
|
1179
|
+
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|