@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.
Files changed (716) hide show
  1. package/.github/workflows/docker-community-push-latest.yml +22 -0
  2. package/.github/workflows/docker-image-tag-community-tag-push.yml +21 -0
  3. package/CHANGELOG.md +637 -212
  4. package/Dockerfile +1 -2
  5. package/LICENSE +21 -661
  6. package/README.md +40 -9
  7. package/angular.json +230 -0
  8. package/browserslist +12 -0
  9. package/config.xml +60 -47
  10. package/deploy_pre.sh +14 -12
  11. package/deploy_prod.sh +26 -6
  12. package/env.sample +28 -9
  13. package/ionic.config.json +2 -2
  14. package/karma.conf.js +31 -0
  15. package/nginx.conf +1 -1
  16. package/package.json +91 -105
  17. package/publish_pre.sh +33 -0
  18. package/publish_prod.sh +33 -0
  19. package/resources/Android/icon/drawable-hdpi-icon.png +0 -0
  20. package/resources/Android/icon/drawable-ldpi-icon.png +0 -0
  21. package/resources/Android/icon/drawable-mdpi-icon.png +0 -0
  22. package/resources/Android/icon/drawable-xhdpi-icon.png +0 -0
  23. package/resources/Android/icon/drawable-xxhdpi-icon.png +0 -0
  24. package/resources/Android/icon/drawable-xxxhdpi-icon.png +0 -0
  25. package/resources/Android/icon.png +0 -0
  26. package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
  27. package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
  28. package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
  29. package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
  30. package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
  31. package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  32. package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
  33. package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
  34. package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
  35. package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
  36. package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
  37. package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  38. package/resources/Android/splash.png +0 -0
  39. package/src/app/app-routing.module.ts +90 -0
  40. package/src/app/app.component.html +26 -0
  41. package/src/app/app.component.scss +11 -0
  42. package/src/app/app.component.spec.ts +47 -0
  43. package/src/app/app.component.ts +1154 -128
  44. package/src/app/app.module.ts +314 -135
  45. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +143 -0
  46. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.scss +335 -0
  47. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.spec.ts +179 -0
  48. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +303 -0
  49. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +149 -0
  50. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +199 -0
  51. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.spec.ts +24 -0
  52. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +97 -0
  53. package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.html +17 -0
  54. package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.scss +83 -0
  55. package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.spec.ts +27 -0
  56. package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.ts +43 -0
  57. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +76 -0
  58. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +51 -0
  59. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.spec.ts +84 -0
  60. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +215 -0
  61. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +3 -0
  62. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +83 -0
  63. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.spec.ts +25 -0
  64. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +37 -0
  65. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +24 -0
  66. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +61 -0
  67. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.spec.ts +25 -0
  68. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +30 -0
  69. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +3 -0
  70. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +47 -0
  71. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.spec.ts +25 -0
  72. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +29 -0
  73. package/src/app/chatlib/conversation-detail/message/frame/frame.component.html +3 -0
  74. package/{bin/chat21-ionic → src/app/chatlib/conversation-detail/message/frame/frame.component.scss} +0 -0
  75. package/src/app/chatlib/conversation-detail/message/frame/frame.component.spec.ts +25 -0
  76. package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +33 -0
  77. package/src/app/chatlib/conversation-detail/message/image/image.component.html +10 -0
  78. package/src/app/chatlib/conversation-detail/message/image/image.component.scss +34 -0
  79. package/src/app/chatlib/conversation-detail/message/image/image.component.spec.ts +35 -0
  80. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +78 -0
  81. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.html +2 -0
  82. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.scss +15 -0
  83. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.spec.ts +27 -0
  84. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +35 -0
  85. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +56 -0
  86. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +169 -0
  87. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.spec.ts +33 -0
  88. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +80 -0
  89. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +18 -0
  90. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.scss +27 -0
  91. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.spec.ts +25 -0
  92. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.ts +24 -0
  93. package/src/app/chatlib/conversation-detail/message/text/text.component.html +5 -0
  94. package/src/app/chatlib/conversation-detail/message/text/text.component.scss +26 -0
  95. package/src/app/chatlib/conversation-detail/message/text/text.component.spec.ts +33 -0
  96. package/src/app/chatlib/conversation-detail/message/text/text.component.ts +56 -0
  97. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +154 -0
  98. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +222 -0
  99. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.spec.ts +24 -0
  100. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +113 -0
  101. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +46 -0
  102. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.scss +200 -0
  103. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.spec.ts +27 -0
  104. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +135 -0
  105. package/src/app/components/authentication/login/login.component.html +65 -0
  106. package/src/app/components/authentication/login/login.component.scss +85 -0
  107. package/src/app/components/authentication/login/login.component.spec.ts +24 -0
  108. package/src/app/components/authentication/login/login.component.ts +174 -0
  109. package/src/app/components/contacts-directory/contacts-directory.component.html +22 -0
  110. package/src/app/components/contacts-directory/contacts-directory.component.scss +123 -0
  111. package/src/app/components/contacts-directory/contacts-directory.component.spec.ts +24 -0
  112. package/src/app/components/contacts-directory/contacts-directory.component.ts +109 -0
  113. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.html +3 -0
  114. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.scss +21 -0
  115. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.spec.ts +24 -0
  116. package/src/app/components/conversation-detail/bubble-day-message/bubble-day-message.component.ts +14 -0
  117. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.html +54 -0
  118. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.scss +98 -0
  119. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.spec.ts +24 -0
  120. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +84 -0
  121. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.html +30 -0
  122. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.scss +83 -0
  123. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.spec.ts +24 -0
  124. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +68 -0
  125. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.html +3 -0
  126. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.scss +10 -0
  127. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.spec.ts +24 -0
  128. package/src/app/components/conversation-detail/bubble-system-message/bubble-system-message.component.ts +14 -0
  129. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +71 -0
  130. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +161 -0
  131. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.spec.ts +24 -0
  132. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +133 -0
  133. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +64 -0
  134. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +124 -0
  135. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.spec.ts +25 -0
  136. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +685 -0
  137. package/src/app/components/conversation-detail/option-header/option-header.component.html +13 -0
  138. package/src/app/components/conversation-detail/option-header/option-header.component.scss +0 -0
  139. package/src/app/components/conversation-detail/option-header/option-header.component.spec.ts +24 -0
  140. package/src/app/components/conversation-detail/option-header/option-header.component.ts +24 -0
  141. package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +64 -0
  142. package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.scss +135 -0
  143. package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.spec.ts +24 -0
  144. package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.ts +53 -0
  145. package/src/app/components/conversation-info/conversation-info.module.ts +13 -0
  146. package/src/app/components/conversation-info/info-content/info-content.component.html +18 -0
  147. package/src/app/components/conversation-info/info-content/info-content.component.scss +5 -0
  148. package/src/app/components/conversation-info/info-content/info-content.component.spec.ts +24 -0
  149. package/src/app/components/conversation-info/info-content/info-content.component.ts +395 -0
  150. package/src/app/components/conversation-info/info-direct/info-direct.component.html +57 -0
  151. package/src/app/components/conversation-info/info-direct/info-direct.component.scss +62 -0
  152. package/src/app/components/conversation-info/info-direct/info-direct.component.spec.ts +24 -0
  153. package/src/app/components/conversation-info/info-direct/info-direct.component.ts +67 -0
  154. package/src/app/components/conversation-info/info-group/info-group.component.html +115 -0
  155. package/src/app/components/conversation-info/info-group/info-group.component.scss +80 -0
  156. package/src/app/components/conversation-info/info-group/info-group.component.spec.ts +24 -0
  157. package/src/app/components/conversation-info/info-group/info-group.component.ts +218 -0
  158. package/src/app/components/conversation-info/info-support-group/info-support-group.component.html +6 -0
  159. package/src/app/components/conversation-info/info-support-group/info-support-group.component.scss +0 -0
  160. package/src/app/components/conversation-info/info-support-group/info-support-group.component.spec.ts +24 -0
  161. package/src/app/components/conversation-info/info-support-group/info-support-group.component.ts +29 -0
  162. package/src/app/components/ddp-header/ddp-header.component.html +31 -0
  163. package/src/app/components/ddp-header/ddp-header.component.scss +26 -0
  164. package/src/app/components/ddp-header/ddp-header.component.spec.ts +24 -0
  165. package/src/app/components/ddp-header/ddp-header.component.ts +33 -0
  166. package/src/app/components/image-viewer/image-viewer.component.html +23 -0
  167. package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
  168. package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
  169. package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
  170. package/src/app/components/project-item/project-item.component.html +147 -0
  171. package/src/app/components/project-item/project-item.component.scss +669 -0
  172. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  173. package/src/app/components/project-item/project-item.component.ts +350 -0
  174. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +12 -0
  175. package/src/app/components/utils/avatar-profile/avatar-profile.component.scss +29 -0
  176. package/src/app/components/utils/avatar-profile/avatar-profile.component.spec.ts +24 -0
  177. package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +41 -0
  178. package/src/app/components/utils/user-presence/user-presence.component.html +2 -0
  179. package/src/app/components/utils/user-presence/user-presence.component.scss +24 -0
  180. package/src/app/components/utils/user-presence/user-presence.component.spec.ts +24 -0
  181. package/src/app/components/utils/user-presence/user-presence.component.ts +159 -0
  182. package/src/app/directives/autofocus.directive.ts +41 -0
  183. package/src/app/directives/html-entities-encode.pipe.spec.ts +8 -0
  184. package/src/app/directives/html-entities-encode.pipe.ts +17 -0
  185. package/src/app/directives/marked.pipe.spec.ts +8 -0
  186. package/src/app/directives/marked.pipe.ts +27 -0
  187. package/src/app/directives/safe-html.pipe.ts +16 -0
  188. package/src/app/pages/authentication/login/login-routing.module.ts +17 -0
  189. package/src/app/pages/authentication/login/login.module.ts +39 -0
  190. package/src/app/pages/authentication/login/login.page.html +7 -0
  191. package/src/app/pages/authentication/login/login.page.scss +5 -0
  192. package/src/app/pages/authentication/login/login.page.spec.ts +24 -0
  193. package/src/app/pages/authentication/login/login.page.ts +187 -0
  194. package/src/app/pages/contacts-directory/contacts-directory-routing.module.ts +17 -0
  195. package/src/app/pages/contacts-directory/contacts-directory.module.ts +42 -0
  196. package/src/app/pages/contacts-directory/contacts-directory.page.html +19 -0
  197. package/src/app/pages/contacts-directory/contacts-directory.page.scss +0 -0
  198. package/src/app/pages/contacts-directory/contacts-directory.page.spec.ts +24 -0
  199. package/src/app/pages/contacts-directory/contacts-directory.page.ts +125 -0
  200. package/src/app/pages/conversation-detail/conversation-detail-routing.module.ts +17 -0
  201. package/src/app/pages/conversation-detail/conversation-detail.module.ts +69 -0
  202. package/src/app/pages/conversation-detail/conversation-detail.page.html +191 -0
  203. package/src/app/pages/conversation-detail/conversation-detail.page.scss +492 -0
  204. package/src/app/pages/conversation-detail/conversation-detail.page.spec.ts +24 -0
  205. package/src/app/pages/conversation-detail/conversation-detail.page.ts +1525 -0
  206. package/src/app/pages/conversations-list/conversations-list-routing.module.ts +17 -0
  207. package/src/app/pages/conversations-list/conversations-list.module.ts +43 -0
  208. package/src/app/pages/conversations-list/conversations-list.page.html +112 -0
  209. package/src/app/pages/conversations-list/conversations-list.page.scss +302 -0
  210. package/src/app/pages/conversations-list/conversations-list.page.spec.ts +24 -0
  211. package/src/app/pages/conversations-list/conversations-list.page.ts +1032 -0
  212. package/src/app/pages/details/details-routing.module.ts +17 -0
  213. package/src/app/pages/details/details.module.ts +21 -0
  214. package/src/app/pages/details/details.page.html +28 -0
  215. package/src/app/pages/details/details.page.scss +23 -0
  216. package/src/app/pages/details/details.page.spec.ts +24 -0
  217. package/src/app/pages/details/details.page.ts +65 -0
  218. package/src/app/pages/loader-preview/loader-preview-routing.module.ts +17 -0
  219. package/src/app/pages/loader-preview/loader-preview.module.ts +29 -0
  220. package/src/app/pages/loader-preview/loader-preview.page.html +62 -0
  221. package/src/app/pages/loader-preview/loader-preview.page.scss +117 -0
  222. package/src/app/pages/loader-preview/loader-preview.page.spec.ts +24 -0
  223. package/src/app/pages/loader-preview/loader-preview.page.ts +353 -0
  224. package/src/app/pages/profile-info/profile-info-routing.module.ts +17 -0
  225. package/src/app/pages/profile-info/profile-info.module.ts +41 -0
  226. package/src/app/pages/profile-info/profile-info.page.html +86 -0
  227. package/src/app/pages/profile-info/profile-info.page.scss +264 -0
  228. package/src/app/pages/profile-info/profile-info.page.spec.ts +24 -0
  229. package/src/app/pages/profile-info/profile-info.page.ts +223 -0
  230. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  231. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  232. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  233. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  234. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  235. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +116 -0
  236. package/src/app/services/app-config.ts +107 -0
  237. package/src/app/services/canned-responses/canned-responses.service.spec.ts +12 -0
  238. package/src/app/services/canned-responses/canned-responses.service.ts +49 -0
  239. package/src/app/services/contacts/contacts.service.spec.ts +12 -0
  240. package/src/app/services/contacts/contacts.service.ts +172 -0
  241. package/src/app/services/events-service.ts +79 -0
  242. package/src/app/services/nav-proxy.service.spec.ts +12 -0
  243. package/src/app/services/nav-proxy.service.ts +80 -0
  244. package/src/app/services/network-service/network.service.spec.ts +12 -0
  245. package/src/app/services/network-service/network.service.ts +46 -0
  246. package/src/app/services/tiledesk/tiledesk.service.spec.ts +12 -0
  247. package/src/app/services/tiledesk/tiledesk.service.ts +99 -0
  248. package/src/app/services/websocket/websocket-js.ts +560 -0
  249. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  250. package/src/app/services/websocket/websocket.service.ts +292 -0
  251. package/src/app/shared/shared-conversation-info.module.ts +33 -0
  252. package/src/app/shared/shared.module.ts +130 -0
  253. package/src/{utils → app/utils}/constants.ts-e +0 -0
  254. package/src/app/utils/scrollbar-theme.directive.ts +63 -0
  255. package/src/assets/i18n/en.json +122 -38
  256. package/src/assets/i18n/it.json +101 -10
  257. package/src/assets/icon/favicon.ico +0 -0
  258. package/src/assets/icon/ionic_favicon.png +0 -0
  259. package/src/assets/images/f21ico-done.svg +1 -0
  260. package/src/assets/images/f21ico-done_all.svg +1 -0
  261. package/src/assets/images/f21ico-schedule.svg +1 -0
  262. package/src/assets/images/file-alt-solid.png +0 -0
  263. package/src/assets/images/no_conversation.jpg +0 -0
  264. package/src/assets/{img → images}/no_image.png +0 -0
  265. package/src/assets/js/chat21client.js +1027 -0
  266. package/src/assets/js/mqtt/4.1.0/mqtt.min.js +1 -0
  267. package/src/assets/js/mqtt/4.2.6/mqtt.min.js +1 -0
  268. package/src/assets/js/mqtt/4.2.8/mqtt.min.js +1 -0
  269. package/src/assets/logo.png +0 -0
  270. package/src/assets/shapes.svg +1 -0
  271. package/src/assets/sounds/pling.mp3 +0 -0
  272. package/src/assets/transparent.png +0 -0
  273. package/src/chat-config-mqtt-ver-uploaded.json +22 -0
  274. package/src/chat-config-mqtt.json +26 -0
  275. package/src/chat-config-pre-test.json +32 -0
  276. package/src/chat-config-pre.json +23 -0
  277. package/src/chat-config-template.json +20 -6
  278. package/src/chat-config.json +30 -0
  279. package/src/{models → chat21-core/models}/conversation.ts +6 -2
  280. package/src/{models → chat21-core/models}/group.ts +7 -5
  281. package/src/{models → chat21-core/models}/message.ts +8 -8
  282. package/src/{models → chat21-core/models}/upload.ts +5 -5
  283. package/src/{models → chat21-core/models}/user.ts +2 -1
  284. package/src/chat21-core/providers/abstract/app-storage.service.spec.ts +15 -0
  285. package/src/chat21-core/providers/abstract/app-storage.service.ts +17 -0
  286. package/src/chat21-core/providers/abstract/archivedconversations-handler.service.spec.ts +13 -0
  287. package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +34 -0
  288. package/src/chat21-core/providers/abstract/conversation-handler-builder.service.spec.ts +12 -0
  289. package/src/chat21-core/providers/abstract/conversation-handler-builder.service.ts +11 -0
  290. package/src/chat21-core/providers/abstract/conversation-handler.service.spec.ts +12 -0
  291. package/src/chat21-core/providers/abstract/conversation-handler.service.ts +43 -0
  292. package/src/chat21-core/providers/abstract/conversations-handler.service.spec.ts +12 -0
  293. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +42 -0
  294. package/src/chat21-core/providers/abstract/groups-handler.service.spec.ts +12 -0
  295. package/src/chat21-core/providers/abstract/groups-handler.service.ts +28 -0
  296. package/src/chat21-core/providers/abstract/image-repo.service.spec.ts +12 -0
  297. package/src/chat21-core/providers/abstract/image-repo.service.ts +26 -0
  298. package/src/chat21-core/providers/abstract/logger.service.spec.ts +12 -0
  299. package/src/chat21-core/providers/abstract/logger.service.ts +16 -0
  300. package/src/chat21-core/providers/abstract/messagingAuth.service.spec.ts +12 -0
  301. package/src/chat21-core/providers/abstract/messagingAuth.service.ts +54 -0
  302. package/src/chat21-core/providers/abstract/notifications.service.spec.ts +12 -0
  303. package/src/chat21-core/providers/abstract/notifications.service.ts +31 -0
  304. package/src/chat21-core/providers/abstract/presence.service.spec.ts +12 -0
  305. package/src/chat21-core/providers/abstract/presence.service.ts +34 -0
  306. package/src/chat21-core/providers/abstract/typing.service.spec.ts +12 -0
  307. package/src/chat21-core/providers/abstract/typing.service.ts +31 -0
  308. package/src/chat21-core/providers/abstract/upload.service.spec.ts +12 -0
  309. package/src/chat21-core/providers/abstract/upload.service.ts +39 -0
  310. package/src/chat21-core/providers/chat-manager.ts +282 -0
  311. package/src/chat21-core/providers/custom-translate.service.spec.ts +12 -0
  312. package/src/chat21-core/providers/custom-translate.service.ts +42 -0
  313. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +476 -0
  314. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +376 -0
  315. package/src/chat21-core/providers/firebase/firebase-conversation-handler-builder.service.ts +19 -0
  316. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +416 -0
  317. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +570 -0
  318. package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +303 -0
  319. package/src/chat21-core/providers/firebase/firebase-image-repo.ts +40 -0
  320. package/src/chat21-core/providers/firebase/firebase-init-service.ts +31 -0
  321. package/src/chat21-core/providers/firebase/firebase-notifications.ts +246 -0
  322. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +190 -0
  323. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +93 -0
  324. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +106 -0
  325. package/src/chat21-core/providers/localSessionStorage.ts +215 -0
  326. package/src/chat21-core/providers/logger/customLogger.ts +70 -0
  327. package/src/chat21-core/providers/logger/loggerInstance.ts +20 -0
  328. package/src/chat21-core/providers/mqtt/chat-service.ts +44 -0
  329. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +707 -0
  330. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +313 -0
  331. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler-builder.service.ts +25 -0
  332. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +446 -0
  333. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +601 -0
  334. package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +139 -0
  335. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +122 -0
  336. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +229 -0
  337. package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +93 -0
  338. package/src/chat21-core/providers/native/native-image-repo.ts +30 -0
  339. package/src/chat21-core/providers/native/native-upload-service.ts +85 -0
  340. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.spec.ts +12 -0
  341. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +211 -0
  342. package/src/chat21-core/utils/constants.ts +109 -0
  343. package/src/chat21-core/utils/user-typing/user-typing.component.html +6 -0
  344. package/src/chat21-core/utils/user-typing/user-typing.component.scss +62 -0
  345. package/src/chat21-core/utils/user-typing/user-typing.component.spec.ts +24 -0
  346. package/src/chat21-core/utils/user-typing/user-typing.component.ts +114 -0
  347. package/src/chat21-core/utils/utils-message.ts +117 -0
  348. package/src/chat21-core/utils/utils-user.ts +46 -0
  349. package/src/chat21-core/utils/utils.ts +893 -0
  350. package/src/firebase-messaging-sw-template.js +1 -1
  351. package/src/global.scss +585 -0
  352. package/src/index.html +71 -42
  353. package/src/main.ts +12 -0
  354. package/src/manifest.json +0 -11
  355. package/src/models/department.ts +12 -0
  356. package/src/polyfills.ts +73 -0
  357. package/src/test.ts +21 -0
  358. package/src/theme/variables.scss +236 -93
  359. package/src/variables.scss +30 -0
  360. package/src/zone-flags.ts +5 -0
  361. package/tsconfig.app.json +14 -0
  362. package/tsconfig.json +23 -18
  363. package/tsconfig.spec.json +19 -0
  364. package/tslint.json +84 -7
  365. package/app.json +0 -7
  366. package/curl +0 -1
  367. package/deploy_dev.sh +0 -28
  368. package/docs/changelog.html +0 -227
  369. package/docs/classes/ConversationModel.html +0 -1022
  370. package/docs/classes/GroupModel.html +0 -527
  371. package/docs/classes/MessageModel.html +0 -843
  372. package/docs/classes/UploadModel.html +0 -417
  373. package/docs/classes/UserModel.html +0 -728
  374. package/docs/classes/_DetailPage.html +0 -144
  375. package/docs/classes/_MasterPage.html +0 -144
  376. package/docs/components/ArchivedConversationsPage.html +0 -1024
  377. package/docs/components/ChatBubble.html +0 -327
  378. package/docs/components/DettaglioConversazionePage.html +0 -6060
  379. package/docs/components/ElasticTextarea.html +0 -619
  380. package/docs/components/InfoAdvancedPage.html +0 -656
  381. package/docs/components/InfoConversationPage.html +0 -5681
  382. package/docs/components/InfoMessagePage.html +0 -993
  383. package/docs/components/InfoUserPage.html +0 -1420
  384. package/docs/components/ListaConversazioniPage.html +0 -3576
  385. package/docs/components/LoginPage.html +0 -1457
  386. package/docs/components/MyApp.html +0 -1388
  387. package/docs/components/PlaceholderPage.html +0 -397
  388. package/docs/components/PopoverPage.html +0 -986
  389. package/docs/components/PopoverProfilePage.html +0 -639
  390. package/docs/components/ProfilePage.html +0 -1187
  391. package/docs/components/RegisterPage.html +0 -1271
  392. package/docs/components/ResetpwdPage.html +0 -1039
  393. package/docs/components/UpdateImageProfilePage.html +0 -997
  394. package/docs/components/UsersPage.html +0 -1297
  395. package/docs/coverage.html +0 -1421
  396. package/docs/dependencies.html +0 -210
  397. package/docs/directives/AutosizeDirective.html +0 -556
  398. package/docs/fonts/FontAwesome.otf +0 -0
  399. package/docs/fonts/fontawesome-webfont.eot +0 -0
  400. package/docs/fonts/fontawesome-webfont.svg +0 -685
  401. package/docs/fonts/fontawesome-webfont.ttf +0 -0
  402. package/docs/fonts/fontawesome-webfont.woff +0 -0
  403. package/docs/fonts/fontawesome-webfont.woff2 +0 -0
  404. package/docs/fonts/ionicons.eot +0 -0
  405. package/docs/fonts/ionicons.svg +0 -2090
  406. package/docs/fonts/ionicons.ttf +0 -0
  407. package/docs/fonts/ionicons.woff +0 -0
  408. package/docs/fonts/ionicons.woff2 +0 -0
  409. package/docs/fonts/roboto-v15-latin-300.eot +0 -0
  410. package/docs/fonts/roboto-v15-latin-300.svg +0 -314
  411. package/docs/fonts/roboto-v15-latin-300.ttf +0 -0
  412. package/docs/fonts/roboto-v15-latin-300.woff +0 -0
  413. package/docs/fonts/roboto-v15-latin-300.woff2 +0 -0
  414. package/docs/fonts/roboto-v15-latin-700.eot +0 -0
  415. package/docs/fonts/roboto-v15-latin-700.svg +0 -310
  416. package/docs/fonts/roboto-v15-latin-700.ttf +0 -0
  417. package/docs/fonts/roboto-v15-latin-700.woff +0 -0
  418. package/docs/fonts/roboto-v15-latin-700.woff2 +0 -0
  419. package/docs/fonts/roboto-v15-latin-italic.eot +0 -0
  420. package/docs/fonts/roboto-v15-latin-italic.svg +0 -323
  421. package/docs/fonts/roboto-v15-latin-italic.ttf +0 -0
  422. package/docs/fonts/roboto-v15-latin-italic.woff +0 -0
  423. package/docs/fonts/roboto-v15-latin-italic.woff2 +0 -0
  424. package/docs/fonts/roboto-v15-latin-regular.eot +0 -0
  425. package/docs/fonts/roboto-v15-latin-regular.svg +0 -308
  426. package/docs/fonts/roboto-v15-latin-regular.ttf +0 -0
  427. package/docs/fonts/roboto-v15-latin-regular.woff +0 -0
  428. package/docs/fonts/roboto-v15-latin-regular.woff2 +0 -0
  429. package/docs/graph/dependencies.svg +0 -870
  430. package/docs/images/compodoc-vectorise-inverted.png +0 -0
  431. package/docs/images/compodoc-vectorise-inverted.svg +0 -201
  432. package/docs/images/compodoc-vectorise.png +0 -0
  433. package/docs/images/compodoc-vectorise.svg +0 -201
  434. package/docs/images/coverage-badge-documentation.svg +0 -9
  435. package/docs/images/coverage-badge.svg +0 -9
  436. package/docs/images/favicon.ico +0 -0
  437. package/docs/index.html +0 -233
  438. package/docs/injectables/AppConfigProvider.html +0 -411
  439. package/docs/injectables/AuthService.html +0 -1016
  440. package/docs/injectables/ChatArchivedConversationsHandler.html +0 -1832
  441. package/docs/injectables/ChatContactsSynchronizer.html +0 -841
  442. package/docs/injectables/ChatConversationHandler.html +0 -1960
  443. package/docs/injectables/ChatConversationsHandler.html +0 -2584
  444. package/docs/injectables/ChatManager.html +0 -1779
  445. package/docs/injectables/ChatPresenceHandler.html +0 -1187
  446. package/docs/injectables/CustomTranslateService.html +0 -496
  447. package/docs/injectables/DatabaseProvider.html +0 -1444
  448. package/docs/injectables/GroupService.html +0 -1458
  449. package/docs/injectables/MessagingService.html +0 -1165
  450. package/docs/injectables/NavProxyService.html +0 -1028
  451. package/docs/injectables/TiledeskConversationProvider.html +0 -945
  452. package/docs/injectables/UploadService.html +0 -791
  453. package/docs/injectables/UserService.html +0 -1612
  454. package/docs/js/compodoc.js +0 -14
  455. package/docs/js/lazy-load-graphs.js +0 -44
  456. package/docs/js/libs/EventDispatcher.js +0 -5
  457. package/docs/js/libs/bootstrap-native.js +0 -2
  458. package/docs/js/libs/clipboard.min.js +0 -7
  459. package/docs/js/libs/custom-elements-es5-adapter.js +0 -15
  460. package/docs/js/libs/custom-elements.min.js +0 -38
  461. package/docs/js/libs/d3.v3.min.js +0 -2
  462. package/docs/js/libs/deep-iterator.js +0 -2
  463. package/docs/js/libs/es6-shim.min.js +0 -11
  464. package/docs/js/libs/htmlparser.js +0 -23
  465. package/docs/js/libs/innersvg.js +0 -9
  466. package/docs/js/libs/lit-html.js +0 -1
  467. package/docs/js/libs/prism.js +0 -14
  468. package/docs/js/libs/promise.min.js +0 -6
  469. package/docs/js/libs/svg-pan-zoom.min.js +0 -3
  470. package/docs/js/libs/tablesort.min.js +0 -6
  471. package/docs/js/libs/tablesort.number.min.js +0 -6
  472. package/docs/js/libs/vis.min.js +0 -46
  473. package/docs/js/libs/zepto.min.js +0 -2
  474. package/docs/js/menu-wc.js +0 -594
  475. package/docs/js/menu.js +0 -261
  476. package/docs/js/routes.js +0 -280
  477. package/docs/js/search/lunr.min.js +0 -6
  478. package/docs/js/search/search-lunr.js +0 -67
  479. package/docs/js/search/search.js +0 -268
  480. package/docs/js/search/search_index.js +0 -4
  481. package/docs/js/sourceCode.js +0 -58
  482. package/docs/js/svg-pan-zoom.controls.js +0 -53
  483. package/docs/js/tabs.js +0 -21
  484. package/docs/js/tree.js +0 -147
  485. package/docs/license.html +0 -664
  486. package/docs/miscellaneous/functions.html +0 -2417
  487. package/docs/miscellaneous/variables.html +0 -994
  488. package/docs/modules/AppModule/dependencies.svg +0 -454
  489. package/docs/modules/AppModule.html +0 -967
  490. package/docs/modules/ArchivedConversationsPageModule/dependencies.svg +0 -50
  491. package/docs/modules/ArchivedConversationsPageModule.html +0 -225
  492. package/docs/modules/DettaglioConversazionePageModule/dependencies.svg +0 -66
  493. package/docs/modules/DettaglioConversazionePageModule.html +0 -256
  494. package/docs/modules/InfoAdvancedPageModule/dependencies.svg +0 -50
  495. package/docs/modules/InfoAdvancedPageModule.html +0 -225
  496. package/docs/modules/InfoConversationPageModule/dependencies.svg +0 -50
  497. package/docs/modules/InfoConversationPageModule.html +0 -227
  498. package/docs/modules/InfoUserPageModule/dependencies.svg +0 -50
  499. package/docs/modules/InfoUserPageModule.html +0 -225
  500. package/docs/modules/ListaConversazioniPageModule/dependencies.svg +0 -66
  501. package/docs/modules/ListaConversazioniPageModule.html +0 -255
  502. package/docs/modules/LoginModule/dependencies.svg +0 -66
  503. package/docs/modules/LoginModule.html +0 -253
  504. package/docs/modules/PlaceholderPageModule/dependencies.svg +0 -66
  505. package/docs/modules/PlaceholderPageModule.html +0 -253
  506. package/docs/modules/PopoverPageModule/dependencies.svg +0 -66
  507. package/docs/modules/PopoverPageModule.html +0 -253
  508. package/docs/modules/PopoverProfilePageModule/dependencies.svg +0 -66
  509. package/docs/modules/PopoverProfilePageModule.html +0 -253
  510. package/docs/modules/ProfilePageModule/dependencies.svg +0 -66
  511. package/docs/modules/ProfilePageModule.html +0 -253
  512. package/docs/modules/RegisterModule/dependencies.svg +0 -66
  513. package/docs/modules/RegisterModule.html +0 -253
  514. package/docs/modules/ResetpwdModule/dependencies.svg +0 -66
  515. package/docs/modules/ResetpwdModule.html +0 -253
  516. package/docs/modules/UpdateImageProfilePageModule/dependencies.svg +0 -66
  517. package/docs/modules/UpdateImageProfilePageModule.html +0 -253
  518. package/docs/modules/UsersModule/dependencies.svg +0 -66
  519. package/docs/modules/UsersModule.html +0 -253
  520. package/docs/modules.html +0 -379
  521. package/docs/overview.html +0 -1033
  522. package/docs/styles/bootstrap-card.css +0 -219
  523. package/docs/styles/bootstrap.min.css +0 -5
  524. package/docs/styles/compodoc.css +0 -996
  525. package/docs/styles/font-awesome.min.css +0 -4
  526. package/docs/styles/ionicons.min.css +0 -11
  527. package/docs/styles/laravel.css +0 -69
  528. package/docs/styles/material.css +0 -109
  529. package/docs/styles/original.css +0 -47
  530. package/docs/styles/postmark.css +0 -224
  531. package/docs/styles/prism.css +0 -267
  532. package/docs/styles/readthedocs.css +0 -108
  533. package/docs/styles/reset.css +0 -48
  534. package/docs/styles/stripe.css +0 -65
  535. package/docs/styles/style.css +0 -7
  536. package/docs/styles/tablesort.css +0 -33
  537. package/docs/styles/vagrant.css +0 -96
  538. package/firebase-functions/.firebaserc +0 -5
  539. package/firebase-functions/firebase.json +0 -1
  540. package/firebase-functions/functions/index.js +0 -208
  541. package/firebase-functions/functions/package.json +0 -9
  542. package/google-services.json +0 -42
  543. package/hooks/README.md +0 -196
  544. package/resources/android/icon/drawable-hdpi-icon.png +0 -0
  545. package/resources/android/icon/drawable-ldpi-icon.png +0 -0
  546. package/resources/android/icon/drawable-mdpi-icon.png +0 -0
  547. package/resources/android/icon/drawable-xhdpi-icon.png +0 -0
  548. package/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
  549. package/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
  550. package/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
  551. package/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
  552. package/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
  553. package/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
  554. package/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
  555. package/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  556. package/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
  557. package/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
  558. package/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
  559. package/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
  560. package/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
  561. package/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  562. package/resources/icon.png +0 -0
  563. package/resources/icon.png.md5 +0 -1
  564. package/resources/ios/icon/icon-1024.png +0 -0
  565. package/resources/ios/icon/icon-40.png +0 -0
  566. package/resources/ios/icon/icon-40@2x.png +0 -0
  567. package/resources/ios/icon/icon-40@3x.png +0 -0
  568. package/resources/ios/icon/icon-50.png +0 -0
  569. package/resources/ios/icon/icon-50@2x.png +0 -0
  570. package/resources/ios/icon/icon-60.png +0 -0
  571. package/resources/ios/icon/icon-60@2x.png +0 -0
  572. package/resources/ios/icon/icon-60@3x.png +0 -0
  573. package/resources/ios/icon/icon-72.png +0 -0
  574. package/resources/ios/icon/icon-72@2x.png +0 -0
  575. package/resources/ios/icon/icon-76.png +0 -0
  576. package/resources/ios/icon/icon-76@2x.png +0 -0
  577. package/resources/ios/icon/icon-83.5@2x.png +0 -0
  578. package/resources/ios/icon/icon-small.png +0 -0
  579. package/resources/ios/icon/icon-small@2x.png +0 -0
  580. package/resources/ios/icon/icon-small@3x.png +0 -0
  581. package/resources/ios/icon/icon.png +0 -0
  582. package/resources/ios/icon/icon@2x.png +0 -0
  583. package/resources/ios/splash/Default-568h@2x~iphone.png +0 -0
  584. package/resources/ios/splash/Default-667h.png +0 -0
  585. package/resources/ios/splash/Default-736h.png +0 -0
  586. package/resources/ios/splash/Default-Landscape-736h.png +0 -0
  587. package/resources/ios/splash/Default-Landscape@2x~ipad.png +0 -0
  588. package/resources/ios/splash/Default-Landscape@~ipadpro.png +0 -0
  589. package/resources/ios/splash/Default-Landscape~ipad.png +0 -0
  590. package/resources/ios/splash/Default-Portrait@2x~ipad.png +0 -0
  591. package/resources/ios/splash/Default-Portrait@~ipadpro.png +0 -0
  592. package/resources/ios/splash/Default-Portrait~ipad.png +0 -0
  593. package/resources/ios/splash/Default@2x~iphone.png +0 -0
  594. package/resources/ios/splash/Default@2x~universal~anyany.png +0 -0
  595. package/resources/ios/splash/Default~iphone.png +0 -0
  596. package/resources/splash.png +0 -0
  597. package/resources/splash.png.md5 +0 -1
  598. package/server.js +0 -7
  599. package/src/app/app.html +0 -56
  600. package/src/app/app.scss +0 -236
  601. package/src/app/main.ts +0 -9
  602. package/src/assets/chat-background.jpg +0 -0
  603. package/src/assets/chat21-ionic-pattern-2.svg +0 -5110
  604. package/src/assets/chat21-ionic-pattern.png +0 -0
  605. package/src/assets/chat21-ionic-pattern.svg +0 -1
  606. package/src/assets/download.svg +0 -1
  607. package/src/assets/dummyDump.sql +0 -1
  608. package/src/assets/icon/favicon_old.ico +0 -0
  609. package/src/assets/img/c21-down-gray.svg +0 -1
  610. package/src/assets/img/chat21-icon.png +0 -0
  611. package/src/assets/img/f21ico-attached.svg +0 -1
  612. package/src/assets/img/f21ico-close.svg +0 -1
  613. package/src/assets/img/f21ico-photo.svg +0 -1
  614. package/src/assets/img/ic_keyboard_arrow_down_black_24px.svg +0 -4
  615. package/src/assets/img/ic_keyboard_arrow_down_white_24px.svg +0 -4
  616. package/src/assets/img/icon.png +0 -0
  617. package/src/assets/message-mine.png +0 -0
  618. package/src/assets/message-other.png +0 -0
  619. package/src/assets/pling.mp3 +0 -0
  620. package/src/assets/splash.png +0 -0
  621. package/src/declarations.d.ts +0 -14
  622. package/src/directives/autosize/autosize.ts +0 -82
  623. package/src/environments/environment.pre.ts +0 -22
  624. package/src/environments/environment.prod.ts +0 -22
  625. package/src/environments/environment.ts +0 -21
  626. package/src/pages/_DetailPage.ts +0 -1
  627. package/src/pages/_MasterPage.ts +0 -1
  628. package/src/pages/archived-conversations/archived-conversations.html +0 -32
  629. package/src/pages/archived-conversations/archived-conversations.module.ts +0 -13
  630. package/src/pages/archived-conversations/archived-conversations.scss +0 -153
  631. package/src/pages/archived-conversations/archived-conversations.ts +0 -121
  632. package/src/pages/authentication/login/login.html +0 -58
  633. package/src/pages/authentication/login/login.module.ts +0 -16
  634. package/src/pages/authentication/login/login.scss +0 -121
  635. package/src/pages/authentication/login/login.ts +0 -221
  636. package/src/pages/authentication/register/register.html +0 -88
  637. package/src/pages/authentication/register/register.module.ts +0 -16
  638. package/src/pages/authentication/register/register.scss +0 -95
  639. package/src/pages/authentication/register/register.ts +0 -122
  640. package/src/pages/authentication/resetpwd/resetpwd.html +0 -40
  641. package/src/pages/authentication/resetpwd/resetpwd.module.ts +0 -16
  642. package/src/pages/authentication/resetpwd/resetpwd.scss +0 -102
  643. package/src/pages/authentication/resetpwd/resetpwd.ts +0 -93
  644. package/src/pages/components/chatBubble_old/chatBubble.scss +0 -83
  645. package/src/pages/components/chatBubble_old/chatBubble.ts +0 -30
  646. package/src/pages/components/elasticTextarea_old.ts +0 -46
  647. package/src/pages/dettaglio-conversazione/dettaglio-conversazione.html +0 -261
  648. package/src/pages/dettaglio-conversazione/dettaglio-conversazione.module.ts +0 -19
  649. package/src/pages/dettaglio-conversazione/dettaglio-conversazione.scss +0 -701
  650. package/src/pages/dettaglio-conversazione/dettaglio-conversazione.ts +0 -1395
  651. package/src/pages/index.ts +0 -5
  652. package/src/pages/info-advanced/info-advanced.html +0 -90
  653. package/src/pages/info-advanced/info-advanced.module.ts +0 -13
  654. package/src/pages/info-advanced/info-advanced.scss +0 -196
  655. package/src/pages/info-advanced/info-advanced.ts +0 -44
  656. package/src/pages/info-conversation/info-conversation.html +0 -225
  657. package/src/pages/info-conversation/info-conversation.module.ts +0 -15
  658. package/src/pages/info-conversation/info-conversation.scss +0 -444
  659. package/src/pages/info-conversation/info-conversation.ts +0 -1233
  660. package/src/pages/info-message/info-message.html +0 -74
  661. package/src/pages/info-message/info-message.module.ts +0 -13
  662. package/src/pages/info-message/info-message.scss +0 -216
  663. package/src/pages/info-message/info-message.ts +0 -89
  664. package/src/pages/info-user/info-user.html +0 -89
  665. package/src/pages/info-user/info-user.module.ts +0 -13
  666. package/src/pages/info-user/info-user.scss +0 -187
  667. package/src/pages/info-user/info-user.ts +0 -177
  668. package/src/pages/lista-conversazioni/lista-conversazioni.html +0 -88
  669. package/src/pages/lista-conversazioni/lista-conversazioni.module.ts +0 -18
  670. package/src/pages/lista-conversazioni/lista-conversazioni.scss +0 -245
  671. package/src/pages/lista-conversazioni/lista-conversazioni.ts +0 -736
  672. package/src/pages/placeholder/placeholder.html +0 -3
  673. package/src/pages/placeholder/placeholder.module.ts +0 -16
  674. package/src/pages/placeholder/placeholder.scss +0 -23
  675. package/src/pages/placeholder/placeholder.ts +0 -18
  676. package/src/pages/popover/popover.html +0 -27
  677. package/src/pages/popover/popover.module.ts +0 -16
  678. package/src/pages/popover/popover.scss +0 -23
  679. package/src/pages/popover/popover.ts +0 -95
  680. package/src/pages/popover-profile/popover-profile.html +0 -20
  681. package/src/pages/popover-profile/popover-profile.module.ts +0 -16
  682. package/src/pages/popover-profile/popover-profile.scss +0 -10
  683. package/src/pages/popover-profile/popover-profile.ts +0 -40
  684. package/src/pages/profile/profile.html +0 -54
  685. package/src/pages/profile/profile.module.ts +0 -16
  686. package/src/pages/profile/profile.scss +0 -45
  687. package/src/pages/profile/profile.ts +0 -108
  688. package/src/pages/update-image-profile/update-image-profile.html +0 -39
  689. package/src/pages/update-image-profile/update-image-profile.module.ts +0 -16
  690. package/src/pages/update-image-profile/update-image-profile.scss +0 -50
  691. package/src/pages/update-image-profile/update-image-profile.ts +0 -111
  692. package/src/pages/users/users.html +0 -55
  693. package/src/pages/users/users.module.ts +0 -16
  694. package/src/pages/users/users.scss +0 -10
  695. package/src/pages/users/users.ts +0 -222
  696. package/src/providers/app-config/app-config.ts +0 -33
  697. package/src/providers/auth-service.ts +0 -140
  698. package/src/providers/canned-responses-service/canned-responses-service.ts +0 -57
  699. package/src/providers/chat-archived-conversations-handler.ts +0 -283
  700. package/src/providers/chat-contacts-synchronizer.ts +0 -179
  701. package/src/providers/chat-conversation-handler.ts +0 -547
  702. package/src/providers/chat-conversations-handler.ts +0 -519
  703. package/src/providers/chat-manager/chat-manager.ts +0 -246
  704. package/src/providers/chat-presence-handler.ts +0 -188
  705. package/src/providers/database/database.ts +0 -214
  706. package/src/providers/group/group.ts +0 -243
  707. package/src/providers/messaging-service.ts +0 -267
  708. package/src/providers/nav-proxy.ts +0 -104
  709. package/src/providers/tiledesk-conversation/tiledesk-conversation.ts +0 -134
  710. package/src/providers/translate-service.ts +0 -61
  711. package/src/providers/upload-service/upload-service.ts +0 -117
  712. package/src/providers/user/user.ts +0 -320
  713. package/src/service-worker.js +0 -30
  714. package/src/utils/constants.ts +0 -73
  715. package/src/utils/utils.ts +0 -548
  716. package/src/videochat.php +0 -20
@@ -0,0 +1,707 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { BehaviorSubject } from 'rxjs';
3
+
4
+ // mqtt
5
+ import {Chat21Service} from './chat-service';
6
+
7
+ // models
8
+ import { ConversationModel } from '../../models/conversation';
9
+
10
+ // services
11
+ import { ConversationsHandlerService } from '../abstract/conversations-handler.service';
12
+
13
+ // utils
14
+ import { TYPE_GROUP } from '../../utils/constants';
15
+ import { getImageUrlThumbFromFirebasestorage, avatarPlaceholder, getColorBck } from '../../utils/utils-user';
16
+ import { compareValues, getFromNow, conversationsPathForUserId, searchIndexInArrayForUid } from '../../utils/utils';
17
+ import { ArchivedConversationsHandlerService } from '../abstract/archivedconversations-handler.service';
18
+
19
+ @Injectable({ providedIn: 'root' })
20
+
21
+ export class MQTTArchivedConversationsHandler extends ArchivedConversationsHandlerService {
22
+
23
+ // BehaviorSubject
24
+ BSConversationDetail: BehaviorSubject<ConversationModel>;
25
+ // readAllMessages: BehaviorSubject<string>;
26
+ archivedConversationAdded: BehaviorSubject<ConversationModel>;
27
+ archivedConversationChanged: BehaviorSubject<ConversationModel>;
28
+ archivedConversationRemoved: BehaviorSubject<ConversationModel>;
29
+ loadedConversationsStorage: BehaviorSubject<ConversationModel[]>;
30
+ BSConversations: BehaviorSubject<ConversationModel[]>
31
+ // imageRepo: ImageRepoService;
32
+
33
+ // public variables
34
+ archivedConversations: Array<ConversationModel> = [];
35
+ uidConvSelected: string;
36
+ tenant: string;
37
+ // FIREBASESTORAGE_BASE_URL_IMAGE: string;
38
+ // urlStorageBucket: string;
39
+
40
+ // private variables
41
+ private loggedUserId: string;
42
+ private translationMap: Map<string, string>;
43
+ private isConversationClosingMap: Map<string, boolean>;
44
+
45
+ private audio: any;
46
+ private setTimeoutSound: any;
47
+
48
+ constructor(
49
+ // private tiledeskConversationsProvider: TiledeskConversationProvider,
50
+ // public databaseProvider: DatabaseProvider,
51
+ public chat21Service: Chat21Service
52
+ ) {
53
+ super();
54
+ }
55
+
56
+ /**
57
+ * inizializzo conversations handler
58
+ */
59
+ initialize(
60
+ tenant: string,
61
+ userId: string,
62
+ translationMap: Map<string, string>
63
+ ) {
64
+ console.log('initialize MQTTConversationsHandler');
65
+ this.loggedUserId = userId;
66
+ this.translationMap = translationMap;
67
+ this.archivedConversations = [];
68
+ // this.databaseProvider.initialize(userId, this.tenant);
69
+ this.isConversationClosingMap = new Map();
70
+ // this.getConversationsFromStorage();
71
+ }
72
+
73
+ public getConversationDetail(conversationWith: string, callback) {
74
+ // 1 cerco array locale
75
+ // 2 cerco remoto
76
+ // callback
77
+
78
+ const conversation = this.archivedConversations.find(conv => conv.conversation_with === conversationWith);
79
+ console.log('found locally? getConversationDetail *****: ', conversation);
80
+ if (conversation) {
81
+ console.log('found!');
82
+ callback(conversation);
83
+ } else {
84
+ console.log('Not found locally, remote.getConversationDetail *****: ', conversation);
85
+ this.chat21Service.chatClient.conversationDetail(conversationWith, (conversation) => {
86
+ if (conversation) {
87
+ if (callback) {
88
+ callback(this.completeConversation(conversation));
89
+ }
90
+ }
91
+ else {
92
+ if (callback) {
93
+ callback(null);
94
+ }
95
+ }
96
+ })
97
+ }
98
+ }
99
+
100
+ setConversationRead(conversationrecipient): void {
101
+ // const urlUpdate = conversationsPathForUserId(this.tenant, this.loggedUserId) + '/' + conversation.recipient;
102
+ // const update = {};
103
+ // console.log('connect -------> conversations update', urlUpdate);
104
+ // update['/is_new'] = false;
105
+ // firebase.database().ref(urlUpdate).update(update);
106
+ }
107
+
108
+ /**
109
+ *
110
+ */
111
+ // private getConversationsFromStorage() {
112
+ // const that = this;
113
+ // this.databaseProvider.getConversations()
114
+ // .then((conversations: [ConversationModel]) => {
115
+ // that.loadedConversationsStorage.next(conversations);
116
+ // // that.events.publish('loadedConversationsStorage', conversations);
117
+ // })
118
+ // .catch((e) => {
119
+ // console.log('error: ', e);
120
+ // });
121
+ // }
122
+
123
+ /**
124
+ * connecting to conversations
125
+ */
126
+ // connect() {
127
+ // console.log('connecting MQTT conversations handler');
128
+ // const handlerConversationAdded = this.chat21Service.chatClient.onConversationAdded( (conv) => {
129
+ // console.log('conversation added:', conv.text);
130
+ // this.added(conv);
131
+ // });
132
+ // const handlerConversationUpdated = this.chat21Service.chatClient.onConversationUpdated( (conv) => {
133
+ // console.log('conversation updated:', conv.text);
134
+ // this.changed(conv);
135
+ // });
136
+ // const handlerConversationDeleted = this.chat21Service.chatClient.onConversationDeleted( (conv) => {
137
+ // console.log('conversation deleted:', conv.text);
138
+ // this.removed(conv);
139
+ // });
140
+ // this.chat21Service.chatClient.lastConversations( (err, conversations) => {
141
+ // console.log('Last conversations', conversations, 'err', err);
142
+ // if (!err) {
143
+ // conversations.forEach(conv => {
144
+ // this.added(conv);
145
+ // });
146
+ // }
147
+ // });
148
+ // // SET AUDIO
149
+ // this.audio = new Audio();
150
+ // this.audio.src = URL_SOUND;
151
+ // this.audio.load();
152
+
153
+
154
+ // ---------------------------------------------------------------------------------
155
+ // New connect - renamed subscribeToConversation
156
+ //----------------------------------------------------------------------------------
157
+ subscribeToConversations(loaded) {
158
+ console.log('connecting MQTT conversations handler');
159
+ const handlerConversationAdded = this.chat21Service.chatClient.onArchivedConversationAdded( (conv) => {
160
+ console.log('conversation added:', conv.text);
161
+ this.added(conv);
162
+ });
163
+ // const handlerConversationUpdated = this.chat21Service.chatClient.onConversationUpdated( (conv) => {
164
+ // console.log('conversation updated:', conv.text);
165
+ // this.changed(conv);
166
+ // });
167
+ const handlerConversationDeleted = this.chat21Service.chatClient.onArchivedConversationDeleted( (conv) => {
168
+ console.log('conversation deleted:', conv.text);
169
+ this.removed(conv);
170
+ });
171
+ this.chat21Service.chatClient.lastConversations( true, (err, conversations) => {
172
+ console.log('Last conversations', conversations, 'err', err);
173
+ if (!err) {
174
+ conversations.forEach(conv => {
175
+ this.added(conv);
176
+ });
177
+ loaded();
178
+ }
179
+ });
180
+ // SET AUDIO
181
+ // this.audio = new Audio();
182
+ // this.audio.src = URL_SOUND;
183
+ // this.audio.load();
184
+ // const that = this;
185
+ // const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId);
186
+ // console.log('connect -------> conversations', urlNodeFirebase);
187
+ // this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
188
+ // this.ref.on('child_changed', (childSnapshot) => {
189
+ // that.changed(childSnapshot);
190
+ // });
191
+ // this.ref.on('child_removed', (childSnapshot) => {
192
+ // that.removed(childSnapshot);
193
+ // });
194
+ // this.ref.on('child_added', (childSnapshot) => {
195
+ // that.added(childSnapshot);
196
+ // });
197
+ }
198
+
199
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
200
+ /**
201
+ * 1 - completo la conversazione con i parametri mancanti
202
+ * 2 - verifico che sia una conversazione valida
203
+ * 3 - salvo stato conversazione (false) nell'array delle conversazioni chiuse
204
+ * 4 - aggiungo alla pos 0 la nuova conversazione all'array di conversazioni
205
+ * o sostituisco la conversazione con quella preesistente
206
+ * 5 - salvo la conversazione nello storage
207
+ * 6 - ordino l'array per timestamp
208
+ * 7 - pubblico conversations:update
209
+ */
210
+ private added(childSnapshot: any) {
211
+ console.log("NEW CONV:::", childSnapshot)
212
+ // const childData: ConversationModel = childSnapshot;
213
+ // childData.uid = childSnapshot.key;
214
+ // const conversation = this.completeConversation(childData);
215
+ // if (this.isValidConversation(childSnapshot.key, conversation)) {
216
+ // this.setClosingConversation(childSnapshot.key, false);
217
+ // // da verificare l'utilità e spostare in questa classe
218
+ // // this.tiledeskConversationsProvider.setClosingConversation(childSnapshot.key, false);
219
+ // const index = searchIndexInArrayForUid(this.conversations, conversation.uid);
220
+ // if (index > -1) {
221
+ // this.conversations.splice(index, 1, conversation);
222
+ // } else {
223
+ // this.conversations.splice(0, 0, conversation);
224
+ // // this.databaseProvider.setConversation(conversation);
225
+ // }
226
+ // this.conversations.sort(compareValues('timestamp', 'desc'));
227
+ // console.log("ALL CONVS:", this.conversations)
228
+ // this.conversationChanged.next(conversation);
229
+ // this.conversationAdded.next(conversation);
230
+ // // this.events.publish('conversationsChanged', this.conversations);
231
+ // } else {
232
+ // console.error('ChatConversationsHandler::added::conversations with conversationId: ', childSnapshot.key, 'is not valid');
233
+ // }
234
+ // let childData: ConversationModel = childSnapshot;
235
+ let conversation = this.completeConversation(childSnapshot);
236
+ conversation.uid = conversation.conversation_with;
237
+ // console.log("NUOVA CONVER;" + conversation.uid)
238
+ console.log("NUOVA CONVER;.uid" + conversation.uid)
239
+ if (this.isValidConversation(conversation)) {
240
+ this.setClosingConversation(conversation.conversation_with, false);
241
+ console.log("NUOVA CONVER;.uid1" + conversation.uid)
242
+ console.log("conversations:", this.archivedConversations)
243
+ console.log("cerco: ", conversation.uid)
244
+ const index = this.searchIndexInArrayForConversationWith(this.archivedConversations, conversation.conversation_with);
245
+ console.log("found index:", index)
246
+ console.log("NUOVA CONVER;.uid2" + conversation.uid)
247
+ if (index > -1) {
248
+ console.log("TROVATO")
249
+ this.archivedConversations.splice(index, 1, conversation);
250
+ } else {
251
+ console.log("NON TROVATO")
252
+ this.archivedConversations.splice(0, 0, conversation);
253
+ // this.databaseProvider.setConversation(conversation);
254
+ }
255
+ console.log("NUOVA CONVER;.uid3" + conversation.uid)
256
+ this.archivedConversations.sort(compareValues('timestamp', 'desc'));
257
+ console.log("NUOVA CONVER;.uid4" + conversation.uid)
258
+ console.log("TUTTE:", this.archivedConversations)
259
+ this.archivedConversationChanged.next(conversation);
260
+ console.log("NUOVA CONVER;.uid5" + conversation.uid)
261
+ this.archivedConversationAdded.next(conversation);
262
+ console.log("NUOVA CONVER;.uid6" + conversation.uid)
263
+ // this.events.publish('conversationsChanged', this.conversations);
264
+ } else {
265
+ console.error('ChatConversationsHandler::added::conversations with conversationId: ', conversation.conversation_with, 'is not valid');
266
+ }
267
+ }
268
+
269
+ searchIndexInArrayForConversationWith(conversations, conversation_with: string) {
270
+ return conversations.findIndex(conv => conv.conversation_with === conversation_with);
271
+ }
272
+
273
+ /**
274
+ * 1 - completo la conversazione con i parametri mancanti
275
+ * 2 - verifico che sia una conversazione valida
276
+ * 3 - aggiungo alla pos 0 la nuova conversazione all'array di conversazioni
277
+ * 4 - salvo la conversazione nello storage
278
+ * 5 - ordino l'array per timestamp
279
+ * 6 - pubblico conversations:update
280
+ * 7 - attivo sound se è un msg nuovo
281
+ */
282
+ // private changed(childSnapshot: any) {
283
+ // const childData: ConversationModel = childSnapshot.val();
284
+ // childData.uid = childSnapshot.key;
285
+ // console.log('changed conversation: ', childData);
286
+ // const conversation = this.completeConversation(childData);
287
+ // if (this.isValidConversation(conversation)) {
288
+ // this.setClosingConversation(childSnapshot.key, false);
289
+ // const index = searchIndexInArrayForUid(this.conversations, conversation.uid);
290
+ // if (index > -1) {
291
+ // this.conversations.splice(index, 1, conversation);
292
+ // }
293
+ // // this.databaseProvider.setConversation(conversation);
294
+ // this.conversations.sort(compareValues('timestamp', 'desc'));
295
+ // this.conversationChanged.next(conversation);
296
+ // // this.events.publish('conversationsChanged', this.conversations);
297
+ // this.conversationChanged.next(conversation);
298
+ // } else {
299
+ // console.error('ChatConversationsHandler::changed::conversations with conversationId: ', childSnapshot.key, 'is not valid');
300
+ // }
301
+ // if (conversation.is_new) {
302
+ // this.soundMessage();
303
+ // }
304
+ // }
305
+
306
+ /**
307
+ * 1 - cerco indice conversazione da eliminare
308
+ * 2 - elimino conversazione da array conversations
309
+ * 3 - elimino la conversazione dallo storage
310
+ * 4 - pubblico conversations:update
311
+ * 5 - elimino conversazione dall'array delle conversazioni chiuse
312
+ */
313
+ private removed(childSnapshot) {
314
+ const index = searchIndexInArrayForUid(this.archivedConversations, childSnapshot.key);
315
+ if (index > -1) {
316
+ const conversationRemoved = this.archivedConversations[index]
317
+ this.archivedConversations.splice(index, 1);
318
+ // this.conversations.sort(compareValues('timestamp', 'desc'));
319
+ // this.databaseProvider.removeConversation(childSnapshot.key);
320
+ this.archivedConversationRemoved.next(conversationRemoved);
321
+ }
322
+ // remove the conversation from the isConversationClosingMap
323
+ this.deleteClosingConversation(childSnapshot.key);
324
+
325
+ // const index = searchIndexInArrayForUid(this.conversations, childSnapshot.key);
326
+ // if (index > -1) {
327
+ // // 2
328
+ // this.conversations.splice(index, 1);
329
+ // // this.conversations.sort(compareValues('timestamp', 'desc'));
330
+ // // 3
331
+ // this.databaseProvider.removeConversation(childSnapshot.key);
332
+ // // 4
333
+ // // this.conversationsChanged.next(this.conversations);
334
+ // this.conversationsRemoved.next(this.conversations);
335
+ // // this.events.publish('conversationsChanged', this.conversations);
336
+ // }
337
+ }
338
+
339
+ /**
340
+ * dispose reference di conversations
341
+ */
342
+ dispose() {
343
+ this.archivedConversations = [];
344
+ this.archivedConversations.length = 0;
345
+ this.uidConvSelected = '';
346
+ }
347
+
348
+ getClosingConversation(conversationId: string) {
349
+ return this.isConversationClosingMap[conversationId];
350
+ }
351
+
352
+ setClosingConversation(conversationId: string, status: boolean) {
353
+ this.isConversationClosingMap[conversationId] = status;
354
+ }
355
+
356
+ deleteClosingConversation(conversationId: string) {
357
+ this.isConversationClosingMap.delete(conversationId);
358
+ }
359
+
360
+ archiveConversation(conversationId: string) {
361
+ // da implementare
362
+ }
363
+
364
+ // ---------------------------------------------------------- //
365
+ // BEGIN FUNCTIONS
366
+ // ---------------------------------------------------------- //
367
+ /**
368
+ * Completo conversazione aggiungendo:
369
+ * 1 - nel caso in cui sender_fullname e recipient_fullname sono vuoti, imposto i rispettivi id come fullname,
370
+ * in modo da avere sempre il campo fullname popolato
371
+ * 2 - imposto conversation_with e conversation_with_fullname con i valori del sender o al recipient,
372
+ * a seconda che il sender corrisponda o meno all'utente loggato. Aggiungo 'tu:' se il sender coincide con il loggedUser
373
+ * Se il sender NON è l'utente loggato, ma è una conversazione di tipo GROUP, il conversation_with_fullname
374
+ * sarà uguale al recipient_fullname
375
+ * 3 - imposto stato conversazione, che indica se ci sono messaggi non letti nella conversazione
376
+ * 4 - imposto il tempo trascorso tra l'ora attuale e l'invio dell'ultimo messaggio
377
+ * 5 - imposto avatar, colore e immagine
378
+ * @param conv
379
+ */
380
+ // public completeConversation(conv: any): ConversationModel {
381
+ // const conversation: ConversationModel = conv;
382
+ // // console.log('completeConversation', conv);
383
+ // if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
384
+ // conversation.sender_fullname = conv.sender;
385
+ // } else {
386
+ // conversation.sender_fullname = conv.sender_fullname;
387
+ // }
388
+ // if (!conv.recipient_fullname || conv.recipient_fullname === 'undefined' || conv.recipient_fullname.trim() === ''){
389
+ // conversation.recipient_fullname = conv.recipient;
390
+ // } else {
391
+ // conversation.recipient_fullname = conv.recipient_fullname;
392
+ // }
393
+ // let LABEL_TU: string;
394
+ // this.translate.get('LABEL_TU').subscribe((res: string) => {
395
+ // LABEL_TU = res;
396
+ // });
397
+ // let conversationWithFullname = conv.sender_fullname;
398
+ // let conversationWith = conv.sender;
399
+ // conversation.last_message_text = conv.last_message_text;
400
+ // if (conv.sender === this.loggedUser.uid) {
401
+ // conversationWith = conv.recipient;
402
+ // conversationWithFullname = conv.recipient_fullname;
403
+ // conversation.last_message_text = LABEL_TU + conv.last_message_text;
404
+ // } else if (conv.channel_type === TYPE_GROUP) {
405
+ // conversationWith = conv.recipient;
406
+ // conversationWithFullname = conv.recipient_fullname;
407
+ // conversation.last_message_text = conv.last_message_text;
408
+ // }
409
+ // conversation.conversation_with_fullname = conversationWithFullname;
410
+
411
+ // conversation.selected = false;
412
+ // console.log('conv.uid', conv.uid);
413
+ // conversation.status = this.setStatusConversation(conv.sender, conv.uid);
414
+
415
+ // conversation.time_last_message = this.getTimeLastMessage(conv.timestamp);
416
+
417
+ // conversation.avatar = avatarPlaceholder(conversationWithFullname);
418
+ // conversation.color = getColorBck(conversationWithFullname);
419
+ // conversation.image = this.getImageUrlThumbFromFirebasestorage(conv.uid);
420
+ // // try {
421
+ // // const FIREBASESTORAGE_BASE_URL_IMAGE = this.appConfig.getConfig().FIREBASESTORAGE_BASE_URL_IMAGE;
422
+ // // conversation.image = getImageUrlThumb(FIREBASESTORAGE_BASE_URL_IMAGE, conversationWith);
423
+ // // } catch (err) {
424
+ // // console.log(err);
425
+ // // }
426
+ // // console.log('completeConversation fine', conversation);
427
+ // return conversation;
428
+ // }
429
+
430
+ private completeConversation(conv): ConversationModel {
431
+ // console.log('completeConversation', conv);
432
+ // const LABEL_TU = this.translationMap.get('LABEL_TU');
433
+ // conv.selected = false;
434
+ // if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
435
+ // conv.sender_fullname = conv.sender;
436
+ // }
437
+ // if (!conv.recipient_fullname || conv.recipient_fullname === 'undefined' || conv.recipient_fullname.trim() === '') {
438
+ // conv.recipient_fullname = conv.recipient;
439
+ // }
440
+ // let conversation_with_fullname = conv.sender_fullname;
441
+ // let conversation_with = conv.sender;
442
+ // if (conv.sender === this.loggedUserId) {
443
+ // conversation_with = conv.recipient;
444
+ // conversation_with_fullname = conv.recipient_fullname;
445
+ // conv.last_message_text = LABEL_TU + conv.last_message_text;
446
+ // } else if (conv.channel_type === TYPE_GROUP) {
447
+ // conversation_with = conv.recipient;
448
+ // conversation_with_fullname = conv.recipient_fullname;
449
+ // conv.last_message_text = conv.last_message_text;
450
+ // }
451
+ // conv.conversation_with_fullname = conversation_with_fullname;
452
+
453
+ // conv.status = this.setStatusConversation(conv.sender, conv.uid);
454
+ // conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
455
+ // conv.avatar = avatarPlaceholder(conversation_with_fullname);
456
+ // conv.color = getColorBck(conversation_with_fullname);
457
+ // return conv;
458
+ console.log('completeConversation', conv);
459
+ conv.selected = false;
460
+ if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
461
+ conv.sender_fullname = conv.sender;
462
+ }
463
+ if (!conv.recipient_fullname || conv.recipient_fullname === 'undefined' || conv.recipient_fullname.trim() === '') {
464
+ conv.recipient_fullname = conv.recipient;
465
+ }
466
+ let conversation_with_fullname = conv.sender_fullname;
467
+ let conversation_with = conv.sender;
468
+ if (conv.sender === this.loggedUserId) {
469
+ conversation_with = conv.recipient;
470
+ conversation_with_fullname = conv.recipient_fullname;
471
+ conv.last_message_text = conv.last_message_text;
472
+ } else if (conv.channel_type === TYPE_GROUP) {
473
+ conversation_with = conv.recipient;
474
+ conversation_with_fullname = conv.recipient_fullname;
475
+ conv.last_message_text = conv.last_message_text;
476
+ }
477
+ conv.conversation_with_fullname = conversation_with_fullname;
478
+ conv.conversation_with = conversation_with;
479
+ conv.status = this.setStatusConversation(conv.sender, conv.uid);
480
+ conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
481
+ conv.avatar = avatarPlaceholder(conversation_with_fullname);
482
+ conv.color = getColorBck(conversation_with_fullname);
483
+ if (!conv.last_message_text) {
484
+ conv.last_message_text = conv.text; // building conv with a message
485
+ }
486
+ return conv;
487
+ }
488
+
489
+ // /**
490
+ // *
491
+ // * @param uid
492
+ // */
493
+ // private getImageUrlThumbFromFirebasestorage(uid: string) {
494
+ // const FIREBASESTORAGE_BASE_URL_IMAGE = this.appConfig.getConfig().FIREBASESTORAGE_BASE_URL_IMAGE;
495
+ // const urlStorageBucket = this.appConfig.getConfig().firebaseConfig.storageBucket + '/o/profiles%2F';
496
+ // const imageurl = FIREBASESTORAGE_BASE_URL_IMAGE + urlStorageBucket + uid + '%2Fthumb_photo.jpg?alt=media';
497
+ // return imageurl;
498
+ // }
499
+
500
+ /** */
501
+ // set the remote conversation as read
502
+ // setConversationRead(conversationUid) {
503
+ // var conversationRef = this.ref.ref.child(conversationUid);
504
+ // conversationRef.update ({"is_new" : false});
505
+ // }
506
+
507
+ /** */
508
+ // getConversationByUid(conversationUid) {
509
+ // const index = searchIndexInArrayForUid(this.conversations, conversationUid);
510
+ // return this.conversations[index];
511
+ // }
512
+
513
+ /** */
514
+ private setStatusConversation(sender, uid): string {
515
+ let status = '0'; // letto
516
+ if (sender === this.loggedUserId || uid === this.uidConvSelected) {
517
+ status = '0';
518
+ } else {
519
+ status = '1'; // non letto
520
+ }
521
+ return status;
522
+ }
523
+
524
+ /**
525
+ * calcolo il tempo trascorso da ora al timestamp passato
526
+ * @param timestamp
527
+ */
528
+ private getTimeLastMessage(timestamp: string) {
529
+ const timestampNumber = parseInt(timestamp) / 1000;
530
+ const time = getFromNow(timestampNumber);
531
+ return time;
532
+ }
533
+
534
+ // removeByUid(uid) {
535
+ // const index = searchIndexInArrayForUid(this.conversations, uid);
536
+ // if (index > -1) {
537
+ // this.conversations.splice(index, 1);
538
+ // // this.events.publish('conversationsChanged', this.conversations);
539
+ // this.conversationsChanged.next(this.conversations);
540
+ // }
541
+ // }
542
+
543
+ // addConversationListener(uidUser, conversationId) {
544
+ // var that = this;
545
+ // this.tenant = environment.tenant;
546
+ // // const tenant = this.chatManager.getTenant();
547
+ // const url = '/apps/' + this.tenant + '/users/' + uidUser + '/conversations/' + conversationId;
548
+ // const reference = firebase.database().ref(url);
549
+ // console.log("ChatConversationsHandler::addConversationListener::reference:",url, reference.toString());
550
+ // reference.on('value', function (snapshot) {
551
+ // setTimeout(function () {
552
+ // // that.events.publish(conversationId + '-listener', snapshot);
553
+ // }, 100);
554
+ // });
555
+ // }
556
+
557
+ /**
558
+ * restituisce il numero di conversazioni nuove
559
+ */
560
+ countIsNew(): number {
561
+ let num = 0;
562
+ this.archivedConversations.forEach((element) => {
563
+ if (element.is_new === true) {
564
+ num++;
565
+ }
566
+ });
567
+ return num;
568
+ }
569
+
570
+ // ---------------------------------------------------------- //
571
+ // END FUNCTIONS
572
+ // ---------------------------------------------------------- //
573
+
574
+ /**
575
+ * attivo sound se è un msg nuovo
576
+ */
577
+ private soundMessage() {
578
+ console.log('****** soundMessage *****', this.audio);
579
+ const that = this;
580
+ // this.audio = new Audio();
581
+ // this.audio.src = 'assets/pling.mp3';
582
+ // this.audio.load();
583
+ this.audio.pause();
584
+ this.audio.currentTime = 0;
585
+ clearTimeout(this.setTimeoutSound);
586
+ this.setTimeoutSound = setTimeout(function () {
587
+ //setTimeout(function() {
588
+ that.audio.play()
589
+ .then(function() {
590
+ // console.log('****** then *****');
591
+ })
592
+ .catch(function() {
593
+ // console.log('***//tiledesk-dashboard/chat*');
594
+ });
595
+ }, 1000);
596
+ }
597
+
598
+ // /**
599
+ // * check if the conversations is valid or not
600
+ // */
601
+ // private isValidConversation(convToCheckId, convToCheck: ConversationModel) : boolean {
602
+ // //console.log("[BEGIN] ChatConversationsHandler:: convToCheck with uid: ", convToCheckId);
603
+ // if (!this.isValidField(convToCheck.uid)) {
604
+ // console.error("ChatConversationsHandler::isValidConversation:: 'uid is not valid' ");
605
+ // return false;
606
+ // }
607
+ // if (!this.isValidField(convToCheck.is_new)) {
608
+ // console.error("ChatConversationsHandler::isValidConversation:: 'is_new is not valid' ");
609
+ // return false;
610
+ // }
611
+ // if (!this.isValidField(convToCheck.last_message_text)) {
612
+ // console.error("ChatConversationsHandler::isValidConversation:: 'last_message_text is not valid' ");
613
+ // return false;
614
+ // }
615
+ // if (!this.isValidField(convToCheck.recipient)) {
616
+ // console.error("ChatConversationsHandler::isValidConversation:: 'recipient is not valid' ");
617
+ // return false;
618
+ // }
619
+ // if (!this.isValidField(convToCheck.recipient_fullname)) {
620
+ // console.error("ChatConversationsHandler::isValidConversation:: 'recipient_fullname is not valid' ");
621
+ // return false;
622
+ // }
623
+ // if (!this.isValidField(convToCheck.sender)) {
624
+ // console.error("ChatConversationsHandler::isValidConversation:: 'sender is not valid' ");
625
+ // return false;
626
+ // }
627
+ // if (!this.isValidField(convToCheck.sender_fullname)) {
628
+ // console.error("ChatConversationsHandler::isValidConversation:: 'sender_fullname is not valid' ");
629
+ // return false;
630
+ // }
631
+ // if (!this.isValidField(convToCheck.status)) {
632
+ // console.error("ChatConversationsHandler::isValidConversation:: 'status is not valid' ");
633
+ // return false;
634
+ // }
635
+ // if (!this.isValidField(convToCheck.timestamp)) {
636
+ // console.error("ChatConversationsHandler::isValidConversation:: 'timestamp is not valid' ");
637
+ // return false;
638
+ // }
639
+ // if (!this.isValidField(convToCheck.channel_type)) {
640
+ // console.error("ChatConversationsHandler::isValidConversation:: 'channel_type is not valid' ");
641
+ // return false;
642
+ // }
643
+ // //console.log("[END] ChatConversationsHandler:: convToCheck with uid: ", convToCheckId);
644
+ // // any other case
645
+ // return true;
646
+ // }
647
+
648
+ /**
649
+ * check if the conversations is valid or not
650
+ */
651
+ private isValidConversation(convToCheck: ConversationModel) : boolean {
652
+ //console.log("[BEGIN] ChatConversationsHandler:: convToCheck with uid: ", convToCheckId);
653
+ console.log("checking uid of", convToCheck)
654
+ console.log("uid is:", convToCheck.uid)
655
+ console.log("channel_type is:", convToCheck.channel_type)
656
+
657
+ if (!this.isValidField(convToCheck.uid)) {
658
+ console.error("ChatConversationsHandler::isValidConversation:: 'uid is not valid' ");
659
+ return false;
660
+ }
661
+ // if (!this.isValidField(convToCheck.is_new)) {
662
+ // console.error("ChatConversationsHandler::isValidConversation:: 'is_new is not valid' ");
663
+ // return false;
664
+ // }
665
+ if (!this.isValidField(convToCheck.last_message_text)) {
666
+ console.error("ChatConversationsHandler::isValidConversation:: 'last_message_text is not valid' ");
667
+ return false;
668
+ }
669
+ if (!this.isValidField(convToCheck.recipient)) {
670
+ console.error("ChatConversationsHandler::isValidConversation:: 'recipient is not valid' ");
671
+ return false;
672
+ }
673
+ if (!this.isValidField(convToCheck.recipient_fullname)) {
674
+ console.error("ChatConversationsHandler::isValidConversation:: 'recipient_fullname is not valid' ");
675
+ return false;
676
+ }
677
+ if (!this.isValidField(convToCheck.sender)) {
678
+ console.error("ChatConversationsHandler::isValidConversation:: 'sender is not valid' ");
679
+ return false;
680
+ }
681
+ if (!this.isValidField(convToCheck.sender_fullname)) {
682
+ console.error("ChatConversationsHandler::isValidConversation:: 'sender_fullname is not valid' ");
683
+ return false;
684
+ }
685
+ if (!this.isValidField(convToCheck.status)) {
686
+ console.error("ChatConversationsHandler::isValidConversation:: 'status is not valid' ");
687
+ return false;
688
+ }
689
+ if (!this.isValidField(convToCheck.timestamp)) {
690
+ console.error("ChatConversationsHandler::isValidConversation:: 'timestamp is not valid' ");
691
+ return false;
692
+ }
693
+ if (!this.isValidField(convToCheck.channel_type)) {
694
+ console.error("ChatConversationsHandler::isValidConversation:: 'channel_type is not valid' ");
695
+ return false;
696
+ }
697
+ //console.log("[END] ChatConversationsHandler:: convToCheck with uid: ", convToCheckId);
698
+ // any other case
699
+ return true;
700
+ }
701
+
702
+ // checks if a conversation's field is valid or not
703
+ private isValidField(field) : boolean{
704
+ return (field === null || field === undefined) ? false : true;
705
+ }
706
+
707
+ }