@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
|
@@ -1,1395 +0,0 @@
|
|
|
1
|
-
import { Component, ViewChild, ElementRef, HostListener } from '@angular/core';
|
|
2
|
-
import { PopoverController, Platform, ActionSheetController, IonicPage, NavParams, Content, Events, NavController } from 'ionic-angular';
|
|
3
|
-
// models
|
|
4
|
-
import { UserModel } from '../../models/user';
|
|
5
|
-
import { MessageModel } from '../../models/message';
|
|
6
|
-
import { UploadModel } from '../../models/upload';
|
|
7
|
-
import { GroupModel } from '../../models/group';
|
|
8
|
-
|
|
9
|
-
// providers services
|
|
10
|
-
import { UserService } from '../../providers/user/user';
|
|
11
|
-
import { NavProxyService } from '../../providers/nav-proxy';
|
|
12
|
-
import { ChatPresenceHandler } from '../../providers/chat-presence-handler';
|
|
13
|
-
import { ChatManager } from '../../providers/chat-manager/chat-manager';
|
|
14
|
-
import { UploadService } from '../../providers/upload-service/upload-service';
|
|
15
|
-
import { ChatConversationHandler } from '../../providers/chat-conversation-handler';
|
|
16
|
-
import { AppConfigProvider } from '../../providers/app-config/app-config';
|
|
17
|
-
import { DatabaseProvider } from '../../providers/database/database';
|
|
18
|
-
import { CannedResponsesServiceProvider } from '../../providers/canned-responses-service/canned-responses-service';
|
|
19
|
-
import { GroupService } from '../../providers/group/group';
|
|
20
|
-
// pages
|
|
21
|
-
import { _DetailPage } from '../_DetailPage';
|
|
22
|
-
import { ProfilePage } from '../profile/profile';
|
|
23
|
-
import { InfoUserPage } from '../info-user/info-user';
|
|
24
|
-
// import { InfoMessagePage } from '../info-message/info-message';
|
|
25
|
-
import { PopoverPage } from '../popover/popover';
|
|
26
|
-
// utils
|
|
27
|
-
import { SYSTEM, TYPE_SUPPORT_GROUP, TYPE_POPUP_DETAIL_MESSAGE, TYPE_DIRECT, MAX_WIDTH_IMAGES, TYPE_MSG_TEXT, TYPE_MSG_IMAGE, MIN_HEIGHT_TEXTAREA, MSG_STATUS_SENDING, MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, TYPE_GROUP, URL_NO_IMAGE, LABEL_NOICON } from '../../utils/constants';
|
|
28
|
-
import { isExistInArray, compareValues, htmlEntities, isURL, isInArray, replaceBr, isPopupUrl, popupUrl, strip_tags, getSizeImg, urlify, convertMessageAndUrlify, getFormatData } from '../../utils/utils';
|
|
29
|
-
|
|
30
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
31
|
-
import { Subscription } from '../../../node_modules/rxjs/Subscription';
|
|
32
|
-
import { ConversationModel } from '../../models/conversation';
|
|
33
|
-
import { timer } from 'rxjs';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@IonicPage()
|
|
39
|
-
@Component({
|
|
40
|
-
selector: 'page-dettaglio-conversazione',
|
|
41
|
-
templateUrl: 'dettaglio-conversazione.html',
|
|
42
|
-
})
|
|
43
|
-
export class DettaglioConversazionePage extends _DetailPage {
|
|
44
|
-
@ViewChild(Content) content: Content;
|
|
45
|
-
@ViewChild('messageTextArea') messageTextArea: ElementRef;
|
|
46
|
-
@ViewChild('scrollMe') private scrollMe: ElementRef;
|
|
47
|
-
|
|
48
|
-
showButtonToBottom = false;
|
|
49
|
-
contentScroll: any;
|
|
50
|
-
NUM_BADGES = 0;
|
|
51
|
-
|
|
52
|
-
private subscriptions: Array<string>;
|
|
53
|
-
private tenant: string;
|
|
54
|
-
private conversationHandler: ChatConversationHandler;
|
|
55
|
-
|
|
56
|
-
private scrollDirection: any = 'bottom';
|
|
57
|
-
private messages: Array<MessageModel> = [];
|
|
58
|
-
private arrayLocalImmages: Array<any> = [];
|
|
59
|
-
private projectId: string;
|
|
60
|
-
public messageSelected: any;
|
|
61
|
-
|
|
62
|
-
//aggiunta
|
|
63
|
-
private conversationSelected: ConversationModel;
|
|
64
|
-
private groupDetailAttributes: any;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
private currentUserDetail: UserModel;
|
|
68
|
-
private memberSelected: UserModel;
|
|
69
|
-
|
|
70
|
-
private conversationWith: string;
|
|
71
|
-
private conversationWithFullname: string;
|
|
72
|
-
|
|
73
|
-
private uidConversationWith: string;
|
|
74
|
-
private fullnameConversationWith: string;
|
|
75
|
-
private conversationType: string;
|
|
76
|
-
|
|
77
|
-
private channel_type: string;
|
|
78
|
-
private online: boolean;
|
|
79
|
-
private lastConnectionDate: string;
|
|
80
|
-
private messageString: string;
|
|
81
|
-
private style_message_welcome: boolean;
|
|
82
|
-
|
|
83
|
-
private selectedFiles: FileList;
|
|
84
|
-
private isFileSelected: boolean;
|
|
85
|
-
private openInfoConversation = false;
|
|
86
|
-
private openInfoUser = false; /** check is open info conversation */
|
|
87
|
-
private openInfoMessage: boolean; /** check is open info message */
|
|
88
|
-
private conversationEnabled: boolean = true;
|
|
89
|
-
private isMobile: boolean = true;
|
|
90
|
-
|
|
91
|
-
private advancedAttributes: any = [];
|
|
92
|
-
private openInfoAdvanced: boolean = false;
|
|
93
|
-
|
|
94
|
-
private tagsCanned: any = [];
|
|
95
|
-
private tagsCannedFilter: any = [];
|
|
96
|
-
public isTypings = false;
|
|
97
|
-
public nameUserTypingNow: string;
|
|
98
|
-
private setTimeoutWritingMessages;
|
|
99
|
-
private conversationMembers: any = [];
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
public TYPE_GROUP = TYPE_GROUP;
|
|
104
|
-
public TYPE_DIRECT = TYPE_DIRECT;
|
|
105
|
-
MSG_STATUS_SENDING = MSG_STATUS_SENDING;
|
|
106
|
-
MSG_STATUS_SENT = MSG_STATUS_SENT;
|
|
107
|
-
MSG_STATUS_RETURN_RECEIPT = MSG_STATUS_RETURN_RECEIPT;
|
|
108
|
-
|
|
109
|
-
urlify = urlify;
|
|
110
|
-
isPopupUrl = isPopupUrl;
|
|
111
|
-
popupUrl = popupUrl;
|
|
112
|
-
strip_tags = strip_tags;
|
|
113
|
-
convertMessageAndUrlify = convertMessageAndUrlify;
|
|
114
|
-
|
|
115
|
-
constructor(
|
|
116
|
-
public popoverCtrl: PopoverController,
|
|
117
|
-
public navParams: NavParams,
|
|
118
|
-
public navCtrl: NavController,
|
|
119
|
-
public chatPresenceHandler: ChatPresenceHandler,
|
|
120
|
-
public navProxy: NavProxyService,
|
|
121
|
-
public userService: UserService,
|
|
122
|
-
public events: Events,
|
|
123
|
-
public chatManager: ChatManager,
|
|
124
|
-
public actionSheetCtrl: ActionSheetController,
|
|
125
|
-
public platform: Platform,
|
|
126
|
-
private upSvc: UploadService,
|
|
127
|
-
private translateService: TranslateService,
|
|
128
|
-
public appConfig: AppConfigProvider,
|
|
129
|
-
private databaseProvider: DatabaseProvider,
|
|
130
|
-
public cannedResponsesServiceProvider: CannedResponsesServiceProvider,
|
|
131
|
-
public groupService: GroupService
|
|
132
|
-
) {
|
|
133
|
-
super();
|
|
134
|
-
console.log('**** constructor DettaglioConversazionePage *****');
|
|
135
|
-
this.tagsCanned = [];
|
|
136
|
-
this.subscriptions = [];
|
|
137
|
-
// passo oggetto conversazione
|
|
138
|
-
this.conversationSelected = navParams.get('conversationSelected');
|
|
139
|
-
console.log('**** this.conversationSelected *****', this.conversationSelected);
|
|
140
|
-
//// recupero id utente e fullname con cui si conversa
|
|
141
|
-
//// uid utente con cui si conversa
|
|
142
|
-
this.conversationWith = navParams.get('conversationWith');
|
|
143
|
-
//// nome utente con cui si conversa
|
|
144
|
-
this.conversationWithFullname = navParams.get('conversationWithFullname');
|
|
145
|
-
//// tipo di canale della chat: direct/group
|
|
146
|
-
this.channel_type = navParams.get('channel_type');
|
|
147
|
-
(!this.channel_type || this.channel_type == 'undefined') ? this.channel_type = TYPE_DIRECT : this.channel_type;
|
|
148
|
-
this.messages = []; // list messages of conversation
|
|
149
|
-
this.isFileSelected = false; // indica se è stato selezionato un file (image da uplodare)
|
|
150
|
-
this.openInfoMessage = false; // indica se è aperto il box info message
|
|
151
|
-
//// init variables
|
|
152
|
-
|
|
153
|
-
//this.initSubscriptions();
|
|
154
|
-
// DESTROY INFO CONVERSATION
|
|
155
|
-
console.log('1 - DESTROY INFO CONVERSATION', this.events);
|
|
156
|
-
this.events.publish('closeDetailConversation', true);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
@HostListener('window:resize', ['$event'])
|
|
161
|
-
onResize(event: any) {
|
|
162
|
-
const newInnerWidth = event.target.innerWidth;
|
|
163
|
-
console.log("newInnerWidth ", newInnerWidth);
|
|
164
|
-
if (newInnerWidth < 768) {
|
|
165
|
-
console.log("sparisci!!!!!", newInnerWidth)
|
|
166
|
-
this.openInfoMessage = false;
|
|
167
|
-
this.openInfoConversation = false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
//// SUBSCRIBTIONS ////
|
|
172
|
-
/**
|
|
173
|
-
* subscriptions list
|
|
174
|
-
*/
|
|
175
|
-
initSubscriptions() {
|
|
176
|
-
console.log('initSubscriptions');
|
|
177
|
-
// subscribe elenco messaggi
|
|
178
|
-
let key = 'doScroll';
|
|
179
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
180
|
-
this.subscriptions.push(key);
|
|
181
|
-
this.events.subscribe(key, this.goToBottom);
|
|
182
|
-
}
|
|
183
|
-
// subscribe dettaglio messaggio
|
|
184
|
-
key = 'openInfoMessage';
|
|
185
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
186
|
-
this.subscriptions.push(key);
|
|
187
|
-
this.events.subscribe(key, this.onOpenInfoMessage);
|
|
188
|
-
}
|
|
189
|
-
// subscribe message videochat
|
|
190
|
-
key = 'openVideoChat';
|
|
191
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
192
|
-
this.subscriptions.push(key);
|
|
193
|
-
this.events.subscribe(key, this.onOpenVideoChat);
|
|
194
|
-
}
|
|
195
|
-
// subscribe isTypings
|
|
196
|
-
key = 'isTypings-'+this.conversationWith;
|
|
197
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
198
|
-
this.subscriptions.push(key);
|
|
199
|
-
this.events.subscribe(key, this.subscribeTypings);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
key = 'changeStatus:closed';
|
|
203
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
204
|
-
this.subscriptions.push(key);
|
|
205
|
-
this.events.subscribe(key, this.onConversationDisabled);
|
|
206
|
-
}
|
|
207
|
-
key = 'changeStatus:reopen';
|
|
208
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
209
|
-
this.subscriptions.push(key);
|
|
210
|
-
this.events.subscribe(key, this.onConversationEnabled);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* init group details subscription
|
|
218
|
-
*/
|
|
219
|
-
loadGroupDetail() {
|
|
220
|
-
console.log('--------------------------> Dettaglio conersazione ::loadGroupDetail');
|
|
221
|
-
const keySubscription = 'conversationGroupDetails';
|
|
222
|
-
if (!isInArray(keySubscription, this.subscriptions)) {
|
|
223
|
-
console.log(' subscribe ::groupDetails');
|
|
224
|
-
this.events.subscribe(keySubscription, this.returnLoadGroupDetail);
|
|
225
|
-
// carico il gruppo in info dettaglio
|
|
226
|
-
//this.groupService.conversationLoadGroupDetail(this.currentUserDetail.uid, this.conversationWith, keySubscription);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* information detail group called of groupService.loadGroupDetail
|
|
232
|
-
*/
|
|
233
|
-
returnLoadGroupDetail = (snapshot) => {
|
|
234
|
-
console.log('<<<<<<<<<<< returnLoadGroupDetail >>>>>>>>>>>>>>>>>>', snapshot.val());
|
|
235
|
-
if (snapshot.val()) {
|
|
236
|
-
const groupDetails = snapshot.val();
|
|
237
|
-
this.groupDetailAttributes = groupDetails.attributes;
|
|
238
|
-
console.log('members::: ', groupDetails.members);
|
|
239
|
-
if(groupDetails && groupDetails.members){
|
|
240
|
-
const members = this.groupService.getUidMembers(groupDetails.members);
|
|
241
|
-
if (!isExistInArray(members, this.currentUserDetail.uid) || members.length <= 1) {
|
|
242
|
-
this.conversationEnabled = false;
|
|
243
|
-
} else {
|
|
244
|
-
this.conversationEnabled = true;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* individuo nella conversazione id e nome dell'utente con il quale sto conversando
|
|
253
|
-
* se il tipo di chat è DIRECT o SUPPORT GROUP: id = recipient/sender e fullname = recipient_fullname/sender_fullname
|
|
254
|
-
* altrimenti se è un semplice GRUPPO: id = recipient e fullname = recipient_fullname
|
|
255
|
-
*/
|
|
256
|
-
setConversationWith() {
|
|
257
|
-
console.log('DETTAGLIO CONV - conversationSelected »»»»»»» : ', this.conversationSelected);
|
|
258
|
-
this.loadGroupDetail();
|
|
259
|
-
//this.loadTagsCanned();
|
|
260
|
-
if (this.conversationSelected) {
|
|
261
|
-
// GROUP CONVERSATION
|
|
262
|
-
this.conversationType = TYPE_GROUP;
|
|
263
|
-
let uidConversationWith = this.conversationSelected.recipient;
|
|
264
|
-
let fullnameConversationWith = this.conversationSelected.recipient_fullname;
|
|
265
|
-
// DIRECT CONVERSATION
|
|
266
|
-
if (this.conversationSelected.channel_type === TYPE_DIRECT) {
|
|
267
|
-
this.conversationType = TYPE_DIRECT;
|
|
268
|
-
if (this.conversationSelected.recipient === this.currentUserDetail.uid) {
|
|
269
|
-
uidConversationWith = this.conversationSelected.sender;
|
|
270
|
-
fullnameConversationWith = this.conversationSelected.sender_fullname;
|
|
271
|
-
} else {
|
|
272
|
-
uidConversationWith = this.conversationSelected.recipient;
|
|
273
|
-
fullnameConversationWith = this.conversationSelected.recipient_fullname;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
// SUPPORT GROUP CONVERSATION
|
|
277
|
-
else if (this.conversationSelected.channel_type === TYPE_GROUP && this.conversationSelected.recipient.startsWith(TYPE_SUPPORT_GROUP)) {
|
|
278
|
-
this.conversationType = TYPE_SUPPORT_GROUP;
|
|
279
|
-
console.log('DETTAGLIO CONV - SUPPORT GROUP CONVERSATION ------------>', this.conversationType)
|
|
280
|
-
console.log('DETTAGLIO CONV - this.conversationSelected ------------>', this.conversationSelected)
|
|
281
|
-
console.log('DETTAGLIO CONV - this.conversationSelected.attributes ------------>', this.conversationSelected.attributes)
|
|
282
|
-
console.log('DETTAGLIO CONV - this.conversationSelected.attributes.requester_id ------------>', this.conversationSelected.attributes.requester_id)
|
|
283
|
-
if (this.conversationSelected.attributes && this.conversationSelected.attributes.requester_id) {
|
|
284
|
-
uidConversationWith = this.conversationSelected.attributes.requester_id;
|
|
285
|
-
console.log('DETTAGLIO CONV - RECUPERO requester_id ------------>', uidConversationWith)
|
|
286
|
-
}
|
|
287
|
-
if (this.conversationSelected.senderAuthInfo && this.conversationSelected.senderAuthInfo.authVar && this.conversationSelected.senderAuthInfo.authVar.uid) {
|
|
288
|
-
// uidConversationWith = this.conversationSelected.senderAuthInfo.authVar.uid;
|
|
289
|
-
fullnameConversationWith = this.conversationSelected.recipient_fullname;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
this.uidConversationWith = uidConversationWith;
|
|
293
|
-
this.fullnameConversationWith = fullnameConversationWith
|
|
294
|
-
console.log('IMPOSTO this.uidConversationWith ------------>', this.uidConversationWith)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (this.uidConversationWith) {
|
|
298
|
-
console.log('SOTTOSCRIZIONE: ', this.conversationType, this.uidConversationWith);
|
|
299
|
-
|
|
300
|
-
if (this.conversationType != TYPE_GROUP) {
|
|
301
|
-
console.log('MI SOTTOSCRIVO SE E DIVERSO DA ', TYPE_GROUP);
|
|
302
|
-
// subscribe data ultima connessione utente con cui si conversa
|
|
303
|
-
let key = 'lastConnectionDate-' + this.uidConversationWith;
|
|
304
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
305
|
-
this.subscriptions.push(key);
|
|
306
|
-
this.events.subscribe(key, this.updateLastConnectionDate);
|
|
307
|
-
}
|
|
308
|
-
// subscribe status utente con il quale si conversa (online/offline)
|
|
309
|
-
key = 'statusUser:online-' + this.uidConversationWith;
|
|
310
|
-
if (!isInArray(key, this.subscriptions)) {
|
|
311
|
-
this.subscriptions.push(key);
|
|
312
|
-
this.events.subscribe(key, this.statusUserOnline);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
*
|
|
327
|
-
*/
|
|
328
|
-
// LISTEN TO SCROLL POSITION
|
|
329
|
-
onScroll(event: any): void {
|
|
330
|
-
console.log('onScroll');
|
|
331
|
-
if (this.scrollMe) {
|
|
332
|
-
const divScrollMe = this.scrollMe.nativeElement;
|
|
333
|
-
const checkContentScrollPosition = this.isContentScrollEnd(divScrollMe);
|
|
334
|
-
if (checkContentScrollPosition) {
|
|
335
|
-
this.showButtonToBottom = false;
|
|
336
|
-
this.NUM_BADGES = 0;
|
|
337
|
-
} else {
|
|
338
|
-
this.showButtonToBottom = true;
|
|
339
|
-
// this.scrollToBottom();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
private isContentScrollEnd(divScrollMe): boolean {
|
|
345
|
-
console.log('isContentScrollEnd');
|
|
346
|
-
if (divScrollMe.scrollTop === (divScrollMe.scrollHeight - divScrollMe.offsetHeight)) {
|
|
347
|
-
return true;
|
|
348
|
-
} else {
|
|
349
|
-
return false;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
//// CALLBACK SUBSCRIBTIONS ////
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
onOpenVideoChat: any = (message) => {
|
|
357
|
-
console.log('onOpenVideoChat');
|
|
358
|
-
this.messageString = message;
|
|
359
|
-
const text_area = this.messageTextArea['_elementRef'].nativeElement.getElementsByTagName('textarea')[0];
|
|
360
|
-
text_area.value = message; //<HTMLInputElement>document.getElementById('chat21-main-message-context');
|
|
361
|
-
text_area.focus();
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* callback sottoscrizione openInfoMessage
|
|
365
|
-
* apre il box di dx del info messaggio
|
|
366
|
-
*/
|
|
367
|
-
onOpenInfoMessage: any = (message) => {
|
|
368
|
-
console.log('onOpenInfoMessage');
|
|
369
|
-
this.openInfoMessage = true;
|
|
370
|
-
this.openInfoConversation = false;
|
|
371
|
-
this.messageSelected = message;
|
|
372
|
-
//console.log('OPEN MESSAGE **************', message);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* on subscribe stato utente con cui si conversa ONLINE
|
|
377
|
-
*/
|
|
378
|
-
statusUserOnline: any = (uid: string, status: boolean) => {
|
|
379
|
-
console.log('************** statusUserOnline', uid, this.conversationWith, status);
|
|
380
|
-
// if(uid !== this.conversationWith){return;}
|
|
381
|
-
if (status === true) {
|
|
382
|
-
console.log('************** ONLINE');
|
|
383
|
-
this.online = true;
|
|
384
|
-
} else {
|
|
385
|
-
console.log('************** OFFLINE');
|
|
386
|
-
this.online = false;
|
|
387
|
-
}
|
|
388
|
-
//this.events.publish('changeStatusUserSelected', (this.online, this.lastConnectionDate));
|
|
389
|
-
}
|
|
390
|
-
// /**
|
|
391
|
-
// * on subscribe stato utente con cui si conversa OFFLINE
|
|
392
|
-
// */
|
|
393
|
-
// statusUserOffline: any = (uid) => {
|
|
394
|
-
// if(uid !== this.conversationWith){return;}
|
|
395
|
-
// this.online = false;
|
|
396
|
-
// this.events.publish('changeStatusUserSelected', (this.online, this.lastConnectionDate));
|
|
397
|
-
// console.log('************** OFFLINE');
|
|
398
|
-
// }
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* on subscribe data ultima connessione utente con cui si conversa
|
|
402
|
-
*/
|
|
403
|
-
updateLastConnectionDate: any = (uid: string, lastConnectionDate: string) => {
|
|
404
|
-
this.lastConnectionDate = lastConnectionDate;
|
|
405
|
-
// this.events.publish('changeStatusUserSelected', (this.online, this.lastConnectionDate));
|
|
406
|
-
console.log('************** updateLastConnectionDate', this.lastConnectionDate);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* on subcribe doScroll add message
|
|
411
|
-
*/
|
|
412
|
-
goToBottom: any = (data) => {
|
|
413
|
-
this.doScroll();
|
|
414
|
-
console.log('*********** goToBottom');
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* on subscribe Typings
|
|
419
|
-
*/
|
|
420
|
-
subscribeTypings: any = (childSnapshot, conversationId) => {
|
|
421
|
-
console.log('*********** subscribeTypings', conversationId, this.conversationWith);
|
|
422
|
-
if(conversationId !== this.conversationWith){
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
if(this.channel_type === TYPE_DIRECT) {
|
|
426
|
-
this.isTypings = true;
|
|
427
|
-
this.nameUserTypingNow = this.fullnameConversationWith;
|
|
428
|
-
} else {
|
|
429
|
-
console.log('child_changed key', childSnapshot.key);
|
|
430
|
-
console.log('child_changed val', childSnapshot.val());
|
|
431
|
-
this.getFullNameUserForId(childSnapshot.key);
|
|
432
|
-
}
|
|
433
|
-
const that = this;
|
|
434
|
-
clearTimeout(this.setTimeoutWritingMessages);
|
|
435
|
-
this.setTimeoutWritingMessages = setTimeout(function () {
|
|
436
|
-
that.isTypings = false;
|
|
437
|
-
}, 2000);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/** */
|
|
441
|
-
onConversationDisabled = () => {
|
|
442
|
-
console.log('onConversationDisabled - idConversation: ');
|
|
443
|
-
this.conversationEnabled = false;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
onConversationEnabled = () => {
|
|
448
|
-
console.log('onConversationEnabled - idConversation: ');
|
|
449
|
-
this.conversationEnabled = true;
|
|
450
|
-
}
|
|
451
|
-
// onConversationEnabled: any = (status) => {
|
|
452
|
-
// console.log('onConversationEnabled');
|
|
453
|
-
// this.conversationEnabled = status;
|
|
454
|
-
// }
|
|
455
|
-
//// UNSUBSCRIPTIONS ////
|
|
456
|
-
/**
|
|
457
|
-
* unsubscribe all subscribe events
|
|
458
|
-
*/
|
|
459
|
-
unsubescribeAll() {
|
|
460
|
-
console.log('unsubescribeAll: ', this.subscriptions);
|
|
461
|
-
this.subscriptions.forEach(subscription => {
|
|
462
|
-
console.log('unsubescribeAll: ', subscription);
|
|
463
|
-
this.events.unsubscribe(subscription, null);
|
|
464
|
-
});
|
|
465
|
-
this.subscriptions = [];
|
|
466
|
-
// this.events.unsubscribe('statusUser:online-'+this.conversationWith, null);
|
|
467
|
-
// this.events.unsubscribe('lastConnectionDate-'+this.conversationWith, null);
|
|
468
|
-
// this.events.unsubscribe('conversationEnabled', null);
|
|
469
|
-
// this.conversationHandler.dispose();
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
//// SYSTEM FUNCTIONS ////
|
|
473
|
-
ngOnInit() {
|
|
474
|
-
console.log('------------> ngOnInit');
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
ionViewWillEnter() {
|
|
479
|
-
console.log('------------> ionViewWillEnter XX', this.conversationSelected);
|
|
480
|
-
console.log('DETTAGLIO:::', this.conversationSelected, this.conversationWith);
|
|
481
|
-
this.initSubscriptions();
|
|
482
|
-
this.initialize();
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
// if(this.conversationSelected){
|
|
487
|
-
// this.initSubscriptions();
|
|
488
|
-
// this.initialize();
|
|
489
|
-
// // console.log(">>>>>>>>>>>> ", this.navProxy.onSplitPaneChanged);
|
|
490
|
-
// } else {
|
|
491
|
-
// this.openInfoConversation = false;
|
|
492
|
-
// }
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* quando ho renderizzato la pagina richiamo il metodo di inizialize
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
ionViewDidEnter() {
|
|
499
|
-
console.log('------------> ionViewDidEnter');
|
|
500
|
-
this.groupService.loadMembersInfo(this.conversationWith, this.tenant, this.currentUserDetail.uid);
|
|
501
|
-
// this.initialize();
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* quando esco dalla pagina distruggo i subscribe
|
|
506
|
-
* e chiudo la finestra di info
|
|
507
|
-
*/
|
|
508
|
-
ionViewWillLeave() {
|
|
509
|
-
console.log('------------> ionViewWillLeave');
|
|
510
|
-
this.openInfoMessage = false;
|
|
511
|
-
this.openInfoConversation = false;
|
|
512
|
-
this.unsubescribeAll();
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
ngAfterViewInit() {
|
|
516
|
-
console.log('------------> ngAfterViewInit ');
|
|
517
|
-
//this.events.subscribe('conversationEnabled', this.onConversationEnabled);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
//// MY FUNCTIONS ////
|
|
521
|
-
/**
|
|
522
|
-
* resetto array messaggi
|
|
523
|
-
* resetto stato online user with
|
|
524
|
-
* resetto data ultima connessione
|
|
525
|
-
* recupero currentUserDetail
|
|
526
|
-
* load stato utente con cui si conversa online/offline
|
|
527
|
-
* load data ultimo aggesso utente con cui si conversa
|
|
528
|
-
* recupero info status user conversation with
|
|
529
|
-
* carico messaggi
|
|
530
|
-
*/
|
|
531
|
-
initialize() {
|
|
532
|
-
console.log('----------> initialize DettaglioConversazionePage', this.chatManager.handlers);
|
|
533
|
-
(!this.channel_type || this.channel_type == 'undefined') ? this.channel_type = TYPE_DIRECT : this.channel_type;
|
|
534
|
-
this.messages = []; // list messages of conversation
|
|
535
|
-
const innerWidth = window.innerWidth;
|
|
536
|
-
console.log('const innerWidth = ', innerWidth);
|
|
537
|
-
if (innerWidth < 768) {
|
|
538
|
-
console.log("sparisci!!!!!")
|
|
539
|
-
this.openInfoMessage = false;
|
|
540
|
-
this.openInfoConversation = false;
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
//this.openInfoConversation = this.chatManager.getOpenInfoConversation();
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
this.online = false;
|
|
547
|
-
this.lastConnectionDate = '';
|
|
548
|
-
this.tenant = this.chatManager.getTenant();
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
this.currentUserDetail = this.chatManager.getLoggedUser();
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
this.setConversationWith();
|
|
555
|
-
console.log('conversationSelected: ', this.uidConversationWith);
|
|
556
|
-
this.chatPresenceHandler.userIsOnline(this.uidConversationWith);
|
|
557
|
-
this.chatPresenceHandler.lastOnlineForUser(this.uidConversationWith);
|
|
558
|
-
this.initConversationHandler();
|
|
559
|
-
|
|
560
|
-
var that = this;
|
|
561
|
-
// NUOVO MESSAGGIO!!
|
|
562
|
-
this.conversationHandler.obsAdded
|
|
563
|
-
.subscribe(newMessage => {
|
|
564
|
-
if (that.scrollMe) {
|
|
565
|
-
const divScrollMe = that.scrollMe.nativeElement;
|
|
566
|
-
const checkContentScrollPosition = that.isContentScrollEnd(divScrollMe);
|
|
567
|
-
if (checkContentScrollPosition) {
|
|
568
|
-
setTimeout(function () {
|
|
569
|
-
that.scrollBottom();
|
|
570
|
-
}, 100);
|
|
571
|
-
} else {
|
|
572
|
-
that.NUM_BADGES++;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
that.isTypings = null;
|
|
576
|
-
});
|
|
577
|
-
this.isFileSelected = false; // indica se è stato selezionato un file (image da uplodare)
|
|
578
|
-
this.openInfoMessage = false; // indica se è aperto il box info message
|
|
579
|
-
this.openInfoConversation = true;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* recupero da chatManager l'handler
|
|
583
|
-
* se NON ESISTE creo un handler e mi connetto
|
|
584
|
-
* se ESISTE mi connetto
|
|
585
|
-
* carico messaggi
|
|
586
|
-
* attendo un sec se nn arrivano messaggi visualizzo msg wellcome
|
|
587
|
-
*/
|
|
588
|
-
initConversationHandler() {
|
|
589
|
-
//const loggedUser = this.chatManager.getLoggedUser();
|
|
590
|
-
const that = this;
|
|
591
|
-
this.style_message_welcome = false;
|
|
592
|
-
// CHIEDE ChatConversationHandler AL CHATMANAGER
|
|
593
|
-
let handler: ChatConversationHandler = this.chatManager.getConversationHandlerByConversationId(this.conversationWith);
|
|
594
|
-
console.log('DETTAGLIO CONV - initConversationHandler **************', this.chatManager, handler, this.conversationWith);
|
|
595
|
-
// SE NN C'è LO CREA CON IL conversationWith -> LO CONNETTE -> LO MEMORIZZA NEL CHATMANAGER
|
|
596
|
-
if (!handler) {
|
|
597
|
-
console.log('DETTAGLIO CONV - ENTRO ***', this.conversationHandler);
|
|
598
|
-
//const handler =
|
|
599
|
-
console.log('DETTAGLIO CONV - CONVERSATION WITH ', this.conversationWith, ' CONVERSATION F-NAME ', this.conversationWithFullname, ' CONVERSATION C U DETAILS ', this.currentUserDetail);
|
|
600
|
-
this.conversationHandler = new ChatConversationHandler(this.events, this.translateService);
|
|
601
|
-
this.conversationHandler.initWithRecipient(this.conversationWith, this.conversationWithFullname, this.currentUserDetail, this.tenant);
|
|
602
|
-
|
|
603
|
-
//this.chatConversationHandler.initWithRecipient(this.conversationWith, this.conversationWithFullname,this.currentUserDetail,this.tenant);
|
|
604
|
-
|
|
605
|
-
//handler = this.chatConversationHandler;
|
|
606
|
-
//this.conversationHandler = handler;
|
|
607
|
-
//[self subscribe:handler];
|
|
608
|
-
//[self.conversationHandler restoreMessagesFromDB];
|
|
609
|
-
if (this.conversationWith) {
|
|
610
|
-
//handler.connect();
|
|
611
|
-
this.conversationHandler.connect();
|
|
612
|
-
this.conversationHandler.initWritingMessages();
|
|
613
|
-
this.conversationHandler.getWritingMessages();
|
|
614
|
-
console.log('PRIMA ***', this.chatManager.handlers);
|
|
615
|
-
this.chatManager.addConversationHandler(this.conversationHandler);
|
|
616
|
-
console.log('DOPO ***', this.chatManager.handlers);
|
|
617
|
-
this.messages = this.conversationHandler.messages;
|
|
618
|
-
console.log('DETTAGLIO CONV - MESSAGES ***', this.messages);
|
|
619
|
-
this.doScroll();
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
else {
|
|
623
|
-
console.log('NON ENTRO ***', this.conversationHandler, handler);
|
|
624
|
-
//handler.connect();
|
|
625
|
-
//[self subscribe:handler];
|
|
626
|
-
this.conversationHandler = handler;
|
|
627
|
-
this.messages = this.conversationHandler.messages;
|
|
628
|
-
this.doScroll();
|
|
629
|
-
}
|
|
630
|
-
// attendo un secondo e poi visualizzo il messaggio se nn ci sono messaggi
|
|
631
|
-
setTimeout(function () {
|
|
632
|
-
//console.log('setTimeout *** 111',that.messages);
|
|
633
|
-
if (!that.messages || that.messages.length == 0) {
|
|
634
|
-
that.style_message_welcome = true;
|
|
635
|
-
console.log('setTimeout *** 111', that.style_message_welcome);
|
|
636
|
-
} else {
|
|
637
|
-
that.doScroll();
|
|
638
|
-
that.onInfoConversation();
|
|
639
|
-
}
|
|
640
|
-
}, 1000);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* chiamato dal subscribe('listMessages:added')
|
|
644
|
-
* ogni volta che viene aggiunto un messaggio
|
|
645
|
-
* aggiorno la lista dei messaggi e mi posiziono sull'ultimo
|
|
646
|
-
* @param messages
|
|
647
|
-
*/
|
|
648
|
-
updateMessageList(messages) {
|
|
649
|
-
// if(!this.updatingMessageList){
|
|
650
|
-
this.messages = messages;
|
|
651
|
-
console.log('updateMessageList **************', this.messages.length);
|
|
652
|
-
this.doScroll();
|
|
653
|
-
// }
|
|
654
|
-
// this.updatingMessageList = true;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
*
|
|
660
|
-
* @param memberID
|
|
661
|
-
*/
|
|
662
|
-
getFullNameUserForId(memberID){
|
|
663
|
-
const that = this;
|
|
664
|
-
console.log('getFullNameUserForId', this.conversationMembers);
|
|
665
|
-
const member = this.conversationMembers.find(item => item.uid === memberID);
|
|
666
|
-
if (!member) {
|
|
667
|
-
if ( memberID.trim() !== ''
|
|
668
|
-
//&& memberID.trim() !== SYSTEM
|
|
669
|
-
&& memberID.trim() !== this.currentUserDetail.uid
|
|
670
|
-
) {
|
|
671
|
-
this.userService.getUserDetail(memberID)
|
|
672
|
-
.then(function (snapshot) {
|
|
673
|
-
if(that.isTypings == false){
|
|
674
|
-
that.isTypings = true;
|
|
675
|
-
}
|
|
676
|
-
console.log('getUserDetail snapshot: ', snapshot.val());
|
|
677
|
-
if (snapshot.val()) {
|
|
678
|
-
const user = snapshot.val();
|
|
679
|
-
const fullname = user.firstname + " " + user.lastname;
|
|
680
|
-
that.nameUserTypingNow = fullname;
|
|
681
|
-
let position = that.conversationMembers.findIndex(i => i.uid === memberID);
|
|
682
|
-
if (position == -1 ) {
|
|
683
|
-
var member = { 'uid': memberID, 'fullname': fullname};
|
|
684
|
-
that.conversationMembers.push(member);
|
|
685
|
-
}
|
|
686
|
-
console.log('getUserDetail: nameUserTypingNow', that.nameUserTypingNow);
|
|
687
|
-
} else {
|
|
688
|
-
that.nameUserTypingNow = that.conversationWithFullname;
|
|
689
|
-
}
|
|
690
|
-
}).catch(function(error) {
|
|
691
|
-
console.log('getUserDetail error: ', error);
|
|
692
|
-
that.nameUserTypingNow = that.conversationWithFullname;
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
// this.userService.getSenderDetail(this.conversationWith)
|
|
696
|
-
// .then(function (snapshot) {
|
|
697
|
-
// if (snapshot.val()) {
|
|
698
|
-
// console.log('::::getSenderDetail::::',snapshot.val() );
|
|
699
|
-
// }
|
|
700
|
-
// });
|
|
701
|
-
}
|
|
702
|
-
} else {
|
|
703
|
-
this.isTypings = true;
|
|
704
|
-
this.nameUserTypingNow = member.fullname;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
//// START Scroll managemant functions ////
|
|
712
|
-
/**
|
|
713
|
-
* Scroll to bottom of page after a short delay.
|
|
714
|
-
*/
|
|
715
|
-
scrollBottom() {
|
|
716
|
-
console.log('scrollBottom');
|
|
717
|
-
var scrollDiv = document.getElementById("scroll-me");
|
|
718
|
-
if (scrollDiv) {
|
|
719
|
-
scrollDiv.scrollTop = scrollDiv.scrollHeight;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Scroll to top of the page after a short delay.
|
|
724
|
-
*/
|
|
725
|
-
scrollTop() {
|
|
726
|
-
console.log('scrollTop');
|
|
727
|
-
let that = this;
|
|
728
|
-
setTimeout(function () {
|
|
729
|
-
that.content.scrollToTop();
|
|
730
|
-
}, 1);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Scroll depending on the direction.
|
|
735
|
-
*/
|
|
736
|
-
doScroll() {
|
|
737
|
-
console.log('doScroll');
|
|
738
|
-
if (this.scrollDirection == 'bottom') {
|
|
739
|
-
this.scrollBottom();
|
|
740
|
-
} else if (this.scrollDirection == 'top') {
|
|
741
|
-
this.scrollTop();
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
//// END Scroll managemant functions ////
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
// //// START FUNZIONI RICHIAMATE DA HTML ////
|
|
748
|
-
// /**
|
|
749
|
-
// * chiude il box di dx del info messaggio
|
|
750
|
-
// */
|
|
751
|
-
// onCloseInfoPage(){
|
|
752
|
-
// if(this.openInfoMessage){
|
|
753
|
-
// this.openInfoMessage = false;
|
|
754
|
-
// } else {
|
|
755
|
-
// this.onOpenCloseInfoConversation();
|
|
756
|
-
// }
|
|
757
|
-
// }
|
|
758
|
-
|
|
759
|
-
returnCloseInfoMessage() {
|
|
760
|
-
console.log('returnCloseInfoMessage');
|
|
761
|
-
this.openInfoMessage = false;
|
|
762
|
-
}
|
|
763
|
-
returnCloseInfoConversation() {
|
|
764
|
-
console.log('returnCloseInfoConversation');
|
|
765
|
-
this.openInfoConversation = false;
|
|
766
|
-
}
|
|
767
|
-
returnOpenInfoUser(member) {
|
|
768
|
-
this.memberSelected = member;
|
|
769
|
-
this.openInfoUser = true;
|
|
770
|
-
console.log('returnOpenInfoUser **************', this.openInfoUser);
|
|
771
|
-
}
|
|
772
|
-
returnCloseInfoUser() {
|
|
773
|
-
this.openInfoUser = false;
|
|
774
|
-
console.log('returnCloseInfoUser **************', this.openInfoUser);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
returnOpenInfoAdvanced(advanced) {
|
|
778
|
-
console.log('returnOpenInfoAdvanced **************', advanced);
|
|
779
|
-
this.advancedAttributes = advanced;
|
|
780
|
-
this.openInfoAdvanced = true;
|
|
781
|
-
}
|
|
782
|
-
returnCloseInfoAdvanced() {
|
|
783
|
-
this.openInfoAdvanced = false;
|
|
784
|
-
this.advancedAttributes = [];
|
|
785
|
-
console.log('returnCloseInfoAdvanced **************', this.openInfoAdvanced);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
*
|
|
792
|
-
*/
|
|
793
|
-
onOpenCloseInfoConversation() {
|
|
794
|
-
this.openInfoMessage = false;
|
|
795
|
-
this.openInfoConversation = !this.openInfoConversation;
|
|
796
|
-
console.log('onOpenCloseInfoConversation **************', this.openInfoConversation);
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
/** */
|
|
800
|
-
onInfoConversation() {
|
|
801
|
-
// ordino array x tempo decrescente
|
|
802
|
-
// cerco messaggi non miei
|
|
803
|
-
// prendo il primo
|
|
804
|
-
console.log('onInfoConversation');
|
|
805
|
-
let msgRicevuti: any;
|
|
806
|
-
let attributes: any[] = [];
|
|
807
|
-
try {
|
|
808
|
-
msgRicevuti = this.messages.find(item => item.sender !== this.currentUserDetail.uid);
|
|
809
|
-
if (msgRicevuti) {
|
|
810
|
-
attributes = msgRicevuti.attributes;
|
|
811
|
-
}
|
|
812
|
-
console.log('msgRicevuti::::: ', msgRicevuti);
|
|
813
|
-
} catch (err) {
|
|
814
|
-
console.log("DettaglioConversazionePage::onInfoConversation:error:", err)
|
|
815
|
-
}
|
|
816
|
-
//const msgRicevuti = this.messages.find(item => item.sender !== this.currentUserDetail.uid);
|
|
817
|
-
//console.log('onUidSelected::::: ', this.conversationWith, this.openInfoConversation);
|
|
818
|
-
//this.events.publish('onOpenInfoConversation', this.openInfoConversation, this.conversationWith, this.channel_type, attributes);
|
|
819
|
-
//this.events.publish('changeStatusUserSelected', (this.online, this.lastConnectionDate));
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Check if the user is the sender of the message.
|
|
824
|
-
* @param message
|
|
825
|
-
*/
|
|
826
|
-
isSender(message) {
|
|
827
|
-
//console.log('isSender');
|
|
828
|
-
const currentUser = this.chatManager.getLoggedUser();
|
|
829
|
-
return this.conversationHandler.isSender(message, currentUser);
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* se il messaggio non è vuoto
|
|
833
|
-
* 1 - ripristino l'altezza del box input a quella di default
|
|
834
|
-
* 2 - invio il messaggio
|
|
835
|
-
* 3 - se l'invio è andato a buon fine mi posiziono sull'ultimo messaggio
|
|
836
|
-
* @param msg
|
|
837
|
-
*/
|
|
838
|
-
sendMessage(msg, type, metadata?) {
|
|
839
|
-
(metadata) ? metadata = metadata : metadata = '';
|
|
840
|
-
console.log("SEND MESSAGE: ", msg, this.messages);
|
|
841
|
-
if (msg && msg.trim() != '' || type !== TYPE_MSG_TEXT) {
|
|
842
|
-
//const textMsg = replaceBr(msg);
|
|
843
|
-
this.messageTextArea['_elementRef'].nativeElement.getElementsByTagName('textarea')[0].style.height = MIN_HEIGHT_TEXTAREA + "px";
|
|
844
|
-
this.conversationHandler.sendMessage(msg, type, metadata, this.conversationWith, this.conversationWithFullname, this.channel_type);
|
|
845
|
-
this.chatManager.conversationsHandler.uidConvSelected = this.conversationWith;
|
|
846
|
-
this.doScroll();
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
*
|
|
852
|
-
* @param metadata
|
|
853
|
-
*/
|
|
854
|
-
// updateMetadataMessage(metadata) {
|
|
855
|
-
// // recupero id nodo messaggio
|
|
856
|
-
// const key = metadata.src.substring(metadata.src.length - 16);
|
|
857
|
-
// const uid = this.arrayLocalImmages[key];
|
|
858
|
-
// console.log("UPDATE MESSAGE: ",key, uid);
|
|
859
|
-
// this.conversationHandler.updateMetadataMessage(uid, metadata);
|
|
860
|
-
// delete this.arrayLocalImmages[key];
|
|
861
|
-
// }
|
|
862
|
-
/**
|
|
863
|
-
* purifico il messaggio
|
|
864
|
-
* e lo passo al metodo di invio
|
|
865
|
-
* @param messageString
|
|
866
|
-
*/
|
|
867
|
-
controlOfMessage(messageString) {
|
|
868
|
-
console.log('controlOfMessage **************');
|
|
869
|
-
messageString = messageString.replace(/(\r\n|\n|\r)/gm, "");
|
|
870
|
-
if (messageString.trim() != '') {
|
|
871
|
-
this.sendMessage(messageString, TYPE_MSG_TEXT);
|
|
872
|
-
}
|
|
873
|
-
this.messageString = "";
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* invocata dalla pressione del tasto invio sul campo di input messaggio
|
|
877
|
-
* se il messaggio non è vuoto lo passo al metodo di controllo
|
|
878
|
-
* @param event
|
|
879
|
-
* @param messageString
|
|
880
|
-
*/
|
|
881
|
-
pressedOnKeyboard(event, messageString) {
|
|
882
|
-
console.log('pressedOnKeyboard ************** event:: ', event);
|
|
883
|
-
if (event.inputType == "insertLineBreak" && event.data == null) {
|
|
884
|
-
this.messageString = "";
|
|
885
|
-
return
|
|
886
|
-
}
|
|
887
|
-
else {
|
|
888
|
-
this.controlOfMessage(messageString);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* metodo chiamato dall'html quando premo sul nome utente nell'header della pagina
|
|
893
|
-
* apro la pg di dettaglio user
|
|
894
|
-
* @param uidReciver
|
|
895
|
-
*/
|
|
896
|
-
goToUserDetail(uidReciver: string) {
|
|
897
|
-
console.log('goToUserDetail::: ', this.navProxy.isOn, uidReciver);
|
|
898
|
-
this.navCtrl.push(ProfilePage, {
|
|
899
|
-
uidUser: uidReciver
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
*
|
|
905
|
-
* @param message
|
|
906
|
-
*/
|
|
907
|
-
getSizeImg(message): any {
|
|
908
|
-
return getSizeImg(message, MAX_WIDTH_IMAGES);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// setUrlString(text, name): any {
|
|
912
|
-
// return name;
|
|
913
|
-
// // if(text) {
|
|
914
|
-
// // return setUrlString(text, name);
|
|
915
|
-
// // } else {
|
|
916
|
-
// // return name;
|
|
917
|
-
// // }
|
|
918
|
-
// }
|
|
919
|
-
|
|
920
|
-
/** */
|
|
921
|
-
showButtonInfo() {
|
|
922
|
-
//console.log('showButtonInfo');
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
*
|
|
926
|
-
* @param msg
|
|
927
|
-
*/
|
|
928
|
-
showDetailMessage(msg) {
|
|
929
|
-
console.log('showDetailMessage', msg);
|
|
930
|
-
//this.presentPopover(msg);
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* apro il menu delle opzioni
|
|
934
|
-
* (metodo richiamato da html)
|
|
935
|
-
* alla chiusura controllo su quale opzione ho premuto e attivo l'azione corrispondete
|
|
936
|
-
*/
|
|
937
|
-
presentPopover(event, msg) {
|
|
938
|
-
console.log('presentPopover');
|
|
939
|
-
let popover = this.popoverCtrl.create(PopoverPage, { typePopup: TYPE_POPUP_DETAIL_MESSAGE, message: msg });
|
|
940
|
-
popover.present({
|
|
941
|
-
ev: event
|
|
942
|
-
});
|
|
943
|
-
/**
|
|
944
|
-
*
|
|
945
|
-
*/
|
|
946
|
-
popover.onDidDismiss((data: string) => {
|
|
947
|
-
console.log(" ********* data::: ", data);
|
|
948
|
-
if (data == 'logOut') {
|
|
949
|
-
//this.logOut();
|
|
950
|
-
}
|
|
951
|
-
else if (data == 'ProfilePage') {
|
|
952
|
-
if (this.chatManager.getLoggedUser()) {
|
|
953
|
-
this.navCtrl.push(ProfilePage);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
//// END FUNZIONI RICHIAMATE DA HTML ////
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
//// START LOAD IMAGE ////
|
|
966
|
-
/**
|
|
967
|
-
*
|
|
968
|
-
* @param event
|
|
969
|
-
*/
|
|
970
|
-
detectFiles(event) {
|
|
971
|
-
console.log('detectFiles');
|
|
972
|
-
if (event && event.target && event.target.files) {
|
|
973
|
-
this.selectedFiles = event.target.files;
|
|
974
|
-
this.fileChange(event);
|
|
975
|
-
console.log('event: ', event.target.files);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
fileChange(event) {
|
|
980
|
-
console.log('fileChange');
|
|
981
|
-
const that = this;
|
|
982
|
-
if (event.target.files && event.target.files[0]) {
|
|
983
|
-
const nameImg = event.target.files[0].name;
|
|
984
|
-
const typeFile = event.target.files[0].type;
|
|
985
|
-
// const preview = document.querySelector('img');
|
|
986
|
-
// const file = document.querySelector('input[type=file]').files[0];
|
|
987
|
-
const reader = new FileReader();
|
|
988
|
-
reader.addEventListener('load', function () {
|
|
989
|
-
that.isFileSelected = true;
|
|
990
|
-
|
|
991
|
-
if (typeFile.indexOf('image') !== -1) {
|
|
992
|
-
const file4Load = new Image;
|
|
993
|
-
// if (typeof reader.result == 'string' || reader.result instanceof String) {}
|
|
994
|
-
file4Load.src = reader.result.toString();
|
|
995
|
-
file4Load.title = nameImg;
|
|
996
|
-
file4Load.onload = function () {
|
|
997
|
-
console.log('that.file4Load: ', file4Load);
|
|
998
|
-
that.arrayLocalImmages.push(file4Load);
|
|
999
|
-
const file = that.selectedFiles.item(0);
|
|
1000
|
-
const uid = file4Load.src.substring(file4Load.src.length - 16);
|
|
1001
|
-
const metadata = {
|
|
1002
|
-
'name': file.name,
|
|
1003
|
-
'src': file4Load.src,
|
|
1004
|
-
'width': file4Load.width,
|
|
1005
|
-
'height': file4Load.height,
|
|
1006
|
-
'type': typeFile,
|
|
1007
|
-
'uid': uid
|
|
1008
|
-
};
|
|
1009
|
-
const type_msg = 'image';
|
|
1010
|
-
// 1 - invio messaggio
|
|
1011
|
-
that.addLocalMessage(metadata, type_msg);
|
|
1012
|
-
// 2 - carico immagine
|
|
1013
|
-
that.uploadSingle(metadata, type_msg);
|
|
1014
|
-
};
|
|
1015
|
-
} else if (typeFile.indexOf('application') !== -1) {
|
|
1016
|
-
const type_msg = 'file';
|
|
1017
|
-
const file = that.selectedFiles.item(0);
|
|
1018
|
-
const metadata = {
|
|
1019
|
-
'name': file.name,
|
|
1020
|
-
'src': event.target.files[0].src,
|
|
1021
|
-
'type': type_msg
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
// 1 - invio messaggio
|
|
1025
|
-
that.addLocalMessage(metadata, type_msg);
|
|
1026
|
-
// 2 - carico immagine
|
|
1027
|
-
that.uploadSingle(metadata, type_msg);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
}, false);
|
|
1031
|
-
if (event.target.files[0]) {
|
|
1032
|
-
reader.readAsDataURL(event.target.files[0]);
|
|
1033
|
-
console.log('reader-result: ', event.target.result);
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
/**
|
|
1039
|
-
* salvo un messaggio localmente nell'array dei msg
|
|
1040
|
-
* @param metadata
|
|
1041
|
-
*/
|
|
1042
|
-
addLocalMessage(metadata, type_msg) {
|
|
1043
|
-
const now: Date = new Date();
|
|
1044
|
-
const timestamp = now.valueOf();
|
|
1045
|
-
const language = document.documentElement.lang;
|
|
1046
|
-
let textMessage = type_msg;
|
|
1047
|
-
if (type_msg === 'image') {
|
|
1048
|
-
textMessage = '';
|
|
1049
|
-
}
|
|
1050
|
-
const message = new MessageModel(
|
|
1051
|
-
metadata.uid, // uid
|
|
1052
|
-
language, // language
|
|
1053
|
-
this.conversationWith, // recipient
|
|
1054
|
-
this.conversationWithFullname, //'Support Group', // recipient_fullname
|
|
1055
|
-
this.currentUserDetail.uid, // sender
|
|
1056
|
-
this.currentUserDetail.fullname, //'Ospite', // sender_fullname
|
|
1057
|
-
'', // status
|
|
1058
|
-
metadata, // metadata
|
|
1059
|
-
textMessage, // text
|
|
1060
|
-
timestamp, // timestamp
|
|
1061
|
-
'', // headerDate
|
|
1062
|
-
type_msg, //TYPE_MSG_IMAGE,
|
|
1063
|
-
'', //attributes
|
|
1064
|
-
'', // channel_type
|
|
1065
|
-
true
|
|
1066
|
-
);
|
|
1067
|
-
|
|
1068
|
-
// if(type_msg == 'file'){
|
|
1069
|
-
// message.text = metadata.src;
|
|
1070
|
-
// }
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
//this.messages.push(message);
|
|
1074
|
-
// message.metadata.uid = message.uid;
|
|
1075
|
-
console.log('addLocalMessage: ', this.messages);
|
|
1076
|
-
//this.isFileSelected = true;
|
|
1077
|
-
this.doScroll();
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
/**
|
|
1081
|
-
*
|
|
1082
|
-
* @param metadata
|
|
1083
|
-
*/
|
|
1084
|
-
uploadSingle(metadata, type_msg) {
|
|
1085
|
-
this.isFileSelected = false;
|
|
1086
|
-
const that = this;
|
|
1087
|
-
const file = this.selectedFiles.item(0);
|
|
1088
|
-
console.log('Uploaded a file! ', file);
|
|
1089
|
-
const currentUpload = new UploadModel(file);
|
|
1090
|
-
let uploadTask = this.upSvc.pushUploadMessage(currentUpload)
|
|
1091
|
-
|
|
1092
|
-
// Register three observers:
|
|
1093
|
-
// 1. 'state_changed' observer, called any time the state changes
|
|
1094
|
-
// 2. Error observer, called on failure
|
|
1095
|
-
// 3. Completion observer, called on successful completion
|
|
1096
|
-
uploadTask.on('state_changed', function (snapshot) {
|
|
1097
|
-
// Observe state change events such as progress, pause, and resume
|
|
1098
|
-
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
|
|
1099
|
-
var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
1100
|
-
console.log('Upload is ' + progress + '% done');
|
|
1101
|
-
}, function (error) {
|
|
1102
|
-
// Handle unsuccessful uploads
|
|
1103
|
-
const errorCode = error.code;
|
|
1104
|
-
const errorMessage = error.message;
|
|
1105
|
-
console.log('error: ', errorCode, errorMessage);
|
|
1106
|
-
}, function () {
|
|
1107
|
-
// Handle successful uploads on complete
|
|
1108
|
-
// For instance, get the download URL: https://firebasestorage.googleapis.com/...
|
|
1109
|
-
uploadTask.snapshot.ref.getDownloadURL().then(function (downloadURL) {
|
|
1110
|
-
console.log('File available at', downloadURL);
|
|
1111
|
-
|
|
1112
|
-
metadata.src = downloadURL;
|
|
1113
|
-
let type_message = TYPE_MSG_TEXT;
|
|
1114
|
-
let message = 'File: ' + metadata.src;
|
|
1115
|
-
if (metadata.type.startsWith('image')) {
|
|
1116
|
-
type_message = TYPE_MSG_IMAGE;
|
|
1117
|
-
message = 'Image: ' + metadata.src;
|
|
1118
|
-
}
|
|
1119
|
-
that.sendMessage(message, type_message, metadata);
|
|
1120
|
-
});
|
|
1121
|
-
});
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
// .then(function(snapshot) {
|
|
1125
|
-
// console.log('1 Uploaded a blob or file! ', snapshot);
|
|
1126
|
-
// // metadata.src = snapshot.downloadURL;
|
|
1127
|
-
// // that.sendMessage('', type_msg, metadata);
|
|
1128
|
-
// metadata.src = snapshot.downloadURL;
|
|
1129
|
-
// let type_message = TYPE_MSG_TEXT;
|
|
1130
|
-
// let message = 'File: ' + metadata.src;
|
|
1131
|
-
// if (metadata.type.startsWith('image')) {
|
|
1132
|
-
// type_message = TYPE_MSG_IMAGE;
|
|
1133
|
-
// message = 'Image: ' + metadata.src;
|
|
1134
|
-
// }
|
|
1135
|
-
// that.sendMessage(message, type_message, metadata);
|
|
1136
|
-
// })
|
|
1137
|
-
// .catch(function(error) {
|
|
1138
|
-
// // Handle Errors here.
|
|
1139
|
-
// const errorCode = error.code;
|
|
1140
|
-
// const errorMessage = error.message;
|
|
1141
|
-
// console.log('error: ', errorCode, errorMessage);
|
|
1142
|
-
// });
|
|
1143
|
-
console.log('reader-result: ', file);
|
|
1144
|
-
}
|
|
1145
|
-
/**
|
|
1146
|
-
*
|
|
1147
|
-
* @param metadata
|
|
1148
|
-
*/
|
|
1149
|
-
onSendImage(metadata) {
|
|
1150
|
-
console.log('onSendImage::::: ', metadata);
|
|
1151
|
-
this.sendMessage('', TYPE_MSG_IMAGE, metadata);
|
|
1152
|
-
this.doScroll();
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
public isImage(message: any) {
|
|
1156
|
-
if (message && message.type && message.metadata && message.metadata.src && message.type === 'image') {
|
|
1157
|
-
return true;
|
|
1158
|
-
}
|
|
1159
|
-
return false;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
public isFile(message: any) {
|
|
1163
|
-
if (message && message.type && message.metadata && message.metadata.src && message.type === 'file') {
|
|
1164
|
-
return false;
|
|
1165
|
-
}
|
|
1166
|
-
return false;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
/**
|
|
1170
|
-
* messageChange
|
|
1171
|
-
*
|
|
1172
|
-
* @param event
|
|
1173
|
-
*/
|
|
1174
|
-
public messageChange(event) {
|
|
1175
|
-
const that = this;
|
|
1176
|
-
console.log("event:::",event);
|
|
1177
|
-
try {
|
|
1178
|
-
if (event) {
|
|
1179
|
-
console.log("event.value:: ", event);
|
|
1180
|
-
var str = event.value;
|
|
1181
|
-
that.setWritingMessages(str);
|
|
1182
|
-
setTimeout(function () {
|
|
1183
|
-
var pos = str.lastIndexOf("/");
|
|
1184
|
-
console.log("str:: ", str);
|
|
1185
|
-
console.log("pos:: ", pos);
|
|
1186
|
-
if(pos >= 0 ) {
|
|
1187
|
-
// && that.tagsCanned.length > 0
|
|
1188
|
-
var strSearch = str.substr(pos+1);
|
|
1189
|
-
that.loadTagsCanned(strSearch);
|
|
1190
|
-
//that.showTagsCanned(strSearch);
|
|
1191
|
-
//that.loadTagsCanned(strSearch);
|
|
1192
|
-
} else {
|
|
1193
|
-
that.tagsCannedFilter = [];
|
|
1194
|
-
}
|
|
1195
|
-
}, 300);
|
|
1196
|
-
that.resizeTextArea();
|
|
1197
|
-
}
|
|
1198
|
-
} catch (err) {
|
|
1199
|
-
console.log("error: ", err)
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
/**
|
|
1204
|
-
*
|
|
1205
|
-
* @param str
|
|
1206
|
-
*/
|
|
1207
|
-
setWritingMessages(str){
|
|
1208
|
-
this.conversationHandler.setWritingMessages(str, this.channel_type);
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
resizeTextArea(){
|
|
1212
|
-
const that = this;
|
|
1213
|
-
setTimeout(function () {
|
|
1214
|
-
try {
|
|
1215
|
-
var text_area = that.messageTextArea['_elementRef'].nativeElement.getElementsByTagName('textarea')[0];
|
|
1216
|
-
if(text_area.value.length <= 0){
|
|
1217
|
-
text_area.style.height = 'auto';
|
|
1218
|
-
} else {
|
|
1219
|
-
text_area.style.height = text_area.scrollHeight + 'px';
|
|
1220
|
-
console.log("text_area.scrollHeight ",text_area.scrollHeight);
|
|
1221
|
-
}
|
|
1222
|
-
//var footerHeight = that.messageTextArea['_elementRef'].nativeElement.offsetHeight+28;
|
|
1223
|
-
//var footerHeight = text_area.offsetHeight;
|
|
1224
|
-
console.log("text_area.nativeElement ",text_area.offsetHeight);
|
|
1225
|
-
|
|
1226
|
-
var footerMessage = document.getElementById("footerMessage");
|
|
1227
|
-
var footerHeight = footerMessage.offsetHeight;
|
|
1228
|
-
console.log("footerMessage.height ", footerHeight);
|
|
1229
|
-
|
|
1230
|
-
console.log('msgRicevuti::::: ', footerHeight);
|
|
1231
|
-
var scrollDiv = document.getElementById("scroll-me");
|
|
1232
|
-
if (scrollDiv) {
|
|
1233
|
-
scrollDiv.parentElement.style.marginBottom = footerHeight+"px";
|
|
1234
|
-
}
|
|
1235
|
-
} catch (err) {
|
|
1236
|
-
console.log("error: ", err)
|
|
1237
|
-
}
|
|
1238
|
-
}, 0);
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
loadTagsCanned(strSearch){
|
|
1243
|
-
// recupero tagsCanned dalla memoria
|
|
1244
|
-
const that = this;
|
|
1245
|
-
console.log('projectId--->XXXX--->> ', this.conversationSelected);//attributes.projectId);
|
|
1246
|
-
console.log('this.appConfig.getConfig().SERVER_BASE_URL--->> ', this.appConfig.getConfig().SERVER_BASE_URL);
|
|
1247
|
-
if(!this.conversationSelected || !this.conversationSelected.attributes || !this.conversationSelected.attributes.projectId || !this.appConfig.getConfig().SERVER_BASE_URL){
|
|
1248
|
-
return;
|
|
1249
|
-
}
|
|
1250
|
-
var projectId = this.conversationSelected.attributes.projectId;
|
|
1251
|
-
var SERVER_BASE_URL = this.appConfig.getConfig().SERVER_BASE_URL;
|
|
1252
|
-
//console.log('SERVER_BASE_URL---> ', SERVER_BASE_URL);//attributes.projectId);
|
|
1253
|
-
// this.contactsService.getLeads(this.queryString, this.pageNo).subscribe((leads_object: any) => {
|
|
1254
|
-
console.log('this.tagsCanned.length---> ', this.tagsCanned.length);//attributes.projectId);
|
|
1255
|
-
//if(this.tagsCanned.length <= 0 ){
|
|
1256
|
-
this.tagsCanned = [];
|
|
1257
|
-
this.cannedResponsesServiceProvider.getCannedResponses(SERVER_BASE_URL, projectId)
|
|
1258
|
-
.toPromise()
|
|
1259
|
-
.then(data => {
|
|
1260
|
-
console.log('----------------------------------> getCannedResponses:');
|
|
1261
|
-
console.log(data);
|
|
1262
|
-
that.tagsCanned = data;
|
|
1263
|
-
that.showTagsCanned(strSearch);
|
|
1264
|
-
}).catch(err => {
|
|
1265
|
-
console.log('error', err);
|
|
1266
|
-
});
|
|
1267
|
-
// } else {
|
|
1268
|
-
// that.showTagsCanned(strSearch);
|
|
1269
|
-
// }
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
/** */
|
|
1273
|
-
showTagsCanned(strSearch){
|
|
1274
|
-
const that = this;
|
|
1275
|
-
that.tagsCannedFilter = [];
|
|
1276
|
-
var tagsCannedClone = JSON.parse(JSON.stringify(that.tagsCanned));
|
|
1277
|
-
//console.log("that.contacts lenght:: ", strSearch);
|
|
1278
|
-
that.tagsCannedFilter = that.filterItems(tagsCannedClone, strSearch);
|
|
1279
|
-
that.tagsCannedFilter.sort(compareValues('title', 'asc'));
|
|
1280
|
-
var strReplace = strSearch;
|
|
1281
|
-
if(strSearch.length > 0){
|
|
1282
|
-
strReplace = "<b>"+strSearch+"</b>";
|
|
1283
|
-
}
|
|
1284
|
-
for(var i=0; i < that.tagsCannedFilter.length; i++) {
|
|
1285
|
-
const textCanned = "<div class='cannedText'>"+that.replacePlaceholderInCanned(that.tagsCannedFilter[i].text)+"</div>";
|
|
1286
|
-
that.tagsCannedFilter[i].title = "<div class='cannedContent'><div class='cannedTitle'>"+that.tagsCannedFilter[i].title.toString().replace(strSearch,strReplace.trim())+"</div>"+textCanned+'</div>';
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
/**
|
|
1294
|
-
* filtro array contatti per parola passata
|
|
1295
|
-
* filtro sul campo fullname
|
|
1296
|
-
* @param items
|
|
1297
|
-
* @param searchTerm
|
|
1298
|
-
*/
|
|
1299
|
-
filterItems(items,searchTerm){
|
|
1300
|
-
//console.log("filterItems::: ",searchTerm);
|
|
1301
|
-
return items.filter((item) => {
|
|
1302
|
-
//console.log("filterItems::: ", item.title.toString().toLowerCase());
|
|
1303
|
-
return item.title.toString().toLowerCase().indexOf(searchTerm.toString().toLowerCase()) > -1;
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
/**
|
|
1308
|
-
*
|
|
1309
|
-
*/
|
|
1310
|
-
replaceTagInMessage(canned){
|
|
1311
|
-
const that = this;
|
|
1312
|
-
this.tagsCannedFilter = [];
|
|
1313
|
-
console.log("canned::: ",canned.text);
|
|
1314
|
-
// // prendo val input
|
|
1315
|
-
var text_area = this.messageTextArea['_elementRef'].nativeElement.getElementsByTagName('textarea')[0];
|
|
1316
|
-
console.log("messageTextArea::: ",text_area.value);
|
|
1317
|
-
|
|
1318
|
-
// replace text
|
|
1319
|
-
var pos = text_area.value.lastIndexOf("/");
|
|
1320
|
-
var strSearch = text_area.value.substr(pos);
|
|
1321
|
-
var strTEMP = text_area.value.replace(strSearch,canned.text);
|
|
1322
|
-
console.log("strSearch::: ",strSearch);
|
|
1323
|
-
console.log("this.conversationSelected.attributes:::::: ",this.conversationSelected.attributes);
|
|
1324
|
-
strTEMP = this.replacePlaceholderInCanned(strTEMP);
|
|
1325
|
-
console.log("strSearch::: ",strSearch);
|
|
1326
|
-
text_area.value = '';
|
|
1327
|
-
that.messageString = strTEMP;
|
|
1328
|
-
//text_area.value = strTEMP;
|
|
1329
|
-
setTimeout(() => {
|
|
1330
|
-
text_area.focus();
|
|
1331
|
-
that.resizeTextArea();
|
|
1332
|
-
},200);
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
replacePlaceholderInCanned(str){
|
|
1336
|
-
if (this.groupDetailAttributes && this.groupDetailAttributes.userEmail) {
|
|
1337
|
-
str = str.replace('$email',this.groupDetailAttributes.userEmail);
|
|
1338
|
-
}
|
|
1339
|
-
if (this.groupDetailAttributes && this.groupDetailAttributes.website) {
|
|
1340
|
-
str = str.replace('$website',this.groupDetailAttributes.website);
|
|
1341
|
-
}
|
|
1342
|
-
if (this.groupDetailAttributes && this.groupDetailAttributes.userFullname) {
|
|
1343
|
-
str = str.replace('$recipient_name',this.groupDetailAttributes.userFullname);
|
|
1344
|
-
}
|
|
1345
|
-
if (this.currentUserDetail && this.currentUserDetail.fullname) {
|
|
1346
|
-
str = str.replace('$agent_name',this.currentUserDetail.fullname);
|
|
1347
|
-
}
|
|
1348
|
-
return str;
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
insertAtCursor(myField, myValue) {
|
|
1354
|
-
console.log('CANNED-RES-CREATE.COMP - insertAtCursor - myValue ', myValue );
|
|
1355
|
-
|
|
1356
|
-
// if (this.addWhiteSpaceBefore === true) {
|
|
1357
|
-
// myValue = ' ' + myValue;
|
|
1358
|
-
// console.log('CANNED-RES-CREATE.COMP - GET TEXT AREA - QUI ENTRO myValue ', myValue );
|
|
1359
|
-
// }
|
|
1360
|
-
|
|
1361
|
-
//IE support
|
|
1362
|
-
if (myField.selection) {
|
|
1363
|
-
myField.focus();
|
|
1364
|
-
let sel = myField.selection.createRange();
|
|
1365
|
-
sel.text = myValue;
|
|
1366
|
-
// this.cannedResponseMessage = sel.text;
|
|
1367
|
-
}
|
|
1368
|
-
//MOZILLA and others
|
|
1369
|
-
else if (myField.selectionStart || myField.selectionStart == '0') {
|
|
1370
|
-
var startPos = myField.selectionStart;
|
|
1371
|
-
console.log('CANNED-RES-CREATE.COMP - insertAtCursor - startPos ', startPos);
|
|
1372
|
-
|
|
1373
|
-
var endPos = myField.selectionEnd;
|
|
1374
|
-
console.log('CANNED-RES-CREATE.COMP - insertAtCursor - endPos ', endPos);
|
|
1375
|
-
|
|
1376
|
-
myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
|
|
1377
|
-
|
|
1378
|
-
// place cursor at end of text in text input element
|
|
1379
|
-
//myField.focus();
|
|
1380
|
-
var val = myField.value; //store the value of the element
|
|
1381
|
-
myField.value = ''; //clear the value of the element
|
|
1382
|
-
myField.value = val + ' '; //set that value back.
|
|
1383
|
-
|
|
1384
|
-
//this.cannedResponseMessage = myField.value;
|
|
1385
|
-
//this.texareaIsEmpty = false;
|
|
1386
|
-
/// myField.select();
|
|
1387
|
-
} else {
|
|
1388
|
-
myField.value += myValue;
|
|
1389
|
-
//this.cannedResponseMessage = myField.value;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
}
|
|
1395
|
-
|