@chat21/chat21-ionic 3.0.5-8.1 → 3.0.6-2.1
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/CHANGELOG.md +300 -0
- package/LICENSE +661 -21
- package/README.md +21 -0
- package/angular.json +4 -0
- package/config.xml +6 -7
- package/deploy_pre.sh +44 -5
- package/deploy_prod.sh +36 -7
- package/env.sample +7 -3
- package/package.json +12 -8
- package/resources/{Android → android}/icon/drawable-hdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-ldpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-mdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/{Android → android}/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/{Android → 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 +36 -17
- package/src/app/app.component.html +18 -5
- package/src/app/app.component.scss +27 -5
- package/src/app/app.component.ts +526 -175
- package/src/app/app.module.ts +29 -12
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +35 -24
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +166 -50
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +113 -18
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +23 -33
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +73 -7
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +46 -11
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +149 -32
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +13 -10
- package/src/app/components/authentication/login/login.component.html +10 -10
- package/src/app/components/authentication/login/login.component.ts +2 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +1 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +45 -39
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +19 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +160 -54
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +101 -38
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +95 -19
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +209 -98
- package/src/app/components/ddp-header/ddp-header.component.html +20 -6
- package/src/app/components/ddp-header/ddp-header.component.scss +4 -0
- package/src/app/components/ddp-header/ddp-header.component.ts +107 -11
- 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 +170 -0
- package/src/app/components/project-item/project-item.component.scss +751 -0
- package/src/app/components/project-item/project-item.component.spec.ts +24 -0
- package/src/app/components/project-item/project-item.component.ts +384 -0
- package/src/app/components/sidebar/sidebar.component.html +275 -0
- package/src/app/components/sidebar/sidebar.component.scss +79 -0
- package/src/app/components/sidebar/sidebar.component.spec.ts +24 -0
- package/src/app/components/sidebar/sidebar.component.ts +541 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +121 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +343 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.spec.ts +24 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +502 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +7 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +22 -5
- package/src/app/pages/authentication/login/login.page.html +1 -2
- package/src/app/pages/authentication/login/login.page.ts +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +9 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.html +55 -49
- package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +1285 -688
- package/src/app/pages/conversations-list/conversations-list.module.ts +2 -1
- package/src/app/pages/conversations-list/conversations-list.page.html +55 -21
- package/src/app/pages/conversations-list/conversations-list.page.scss +309 -127
- package/src/app/pages/conversations-list/conversations-list.page.ts +833 -358
- package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
- package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
- package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
- package/src/app/pages/create-requester/create-requester-routing.module.ts +17 -0
- package/src/app/pages/create-requester/create-requester.module.ts +28 -0
- package/src/app/pages/create-requester/create-requester.page.html +67 -0
- package/src/app/pages/create-requester/create-requester.page.scss +30 -0
- package/src/app/pages/create-requester/create-requester.page.spec.ts +24 -0
- package/src/app/pages/create-requester/create-requester.page.ts +138 -0
- package/src/app/pages/create-ticket/create-ticket-routing.module.ts +17 -0
- package/src/app/pages/create-ticket/create-ticket.module.ts +28 -0
- package/src/app/pages/create-ticket/create-ticket.page.html +171 -0
- package/src/app/pages/create-ticket/create-ticket.page.scss +52 -0
- package/src/app/pages/create-ticket/create-ticket.page.spec.ts +24 -0
- package/src/app/pages/create-ticket/create-ticket.page.ts +432 -0
- package/src/app/pages/loader-preview/loader-preview.page.ts +226 -166
- package/src/app/pages/profile-info/profile-info.page.html +4 -4
- package/src/app/pages/profile-info/profile-info.page.scss +13 -2
- package/src/app/pages/profile-info/profile-info.page.ts +23 -21
- 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 +27 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +173 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +151 -0
- package/src/app/services/app-config.ts +77 -5
- package/src/app/services/nav-proxy.service.ts +1 -1
- package/src/app/services/tiledesk/tiledesk.service.ts +231 -1
- 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.module.ts +28 -8
- package/src/app/utils/scrollbar-theme.directive.ts +58 -24
- package/src/assets/i18n/de.json +265 -0
- package/src/assets/i18n/en.json +89 -7
- package/src/assets/i18n/es.json +265 -0
- package/src/assets/i18n/fr.json +265 -0
- package/src/assets/i18n/it.json +108 -34
- package/src/assets/i18n/pt.json +265 -0
- package/src/assets/i18n/ru.json +265 -0
- package/src/assets/i18n/sr.json +265 -0
- package/src/assets/i18n/tr.json +265 -0
- package/src/assets/images/default-avatar-x-select.png +0 -0
- package/src/assets/images/language_flag/ar.png +0 -0
- package/src/assets/images/language_flag/bg.png +0 -0
- package/src/assets/images/language_flag/ca.png +0 -0
- package/src/assets/images/language_flag/cs.png +0 -0
- package/src/assets/images/language_flag/da.png +0 -0
- package/src/assets/images/language_flag/de.png +0 -0
- package/src/assets/images/language_flag/el.png +0 -0
- package/src/assets/images/language_flag/en.png +0 -0
- package/src/assets/images/language_flag/es.png +0 -0
- package/src/assets/images/language_flag/fa.png +0 -0
- package/src/assets/images/language_flag/fi.png +0 -0
- package/src/assets/images/language_flag/fr.png +0 -0
- package/src/assets/images/language_flag/he.png +0 -0
- package/src/assets/images/language_flag/hi.png +0 -0
- package/src/assets/images/language_flag/hr.png +0 -0
- package/src/assets/images/language_flag/hu.png +0 -0
- package/src/assets/images/language_flag/id.png +0 -0
- package/src/assets/images/language_flag/it.png +0 -0
- package/src/assets/images/language_flag/ja.png +0 -0
- package/src/assets/images/language_flag/ko.png +0 -0
- package/src/assets/images/language_flag/ml-IN.png +0 -0
- package/src/assets/images/language_flag/ne-NP.png +0 -0
- package/src/assets/images/language_flag/nl.png +0 -0
- package/src/assets/images/language_flag/no.png +0 -0
- package/src/assets/images/language_flag/pl.png +0 -0
- package/src/assets/images/language_flag/pt-BR.png +0 -0
- package/src/assets/images/language_flag/pt.png +0 -0
- package/src/assets/images/language_flag/ro.png +0 -0
- package/src/assets/images/language_flag/ru.png +0 -0
- package/src/assets/images/language_flag/sk.png +0 -0
- package/src/assets/images/language_flag/sl.png +0 -0
- package/src/assets/images/language_flag/sr.png +0 -0
- package/src/assets/images/language_flag/sv-SE.png +0 -0
- package/src/assets/images/language_flag/ta.png +0 -0
- package/src/assets/images/language_flag/th.png +0 -0
- package/src/assets/images/language_flag/tr.png +0 -0
- package/src/assets/images/language_flag/uk.png +0 -0
- package/src/assets/images/language_flag/vi.png +0 -0
- package/src/assets/images/language_flag/zh-CN.png +0 -0
- package/src/assets/images/language_flag/zh-TW.png +0 -0
- package/src/assets/images/no_image_user.png +0 -0
- package/src/assets/images/priority_icons/high.svg +3 -0
- package/src/assets/images/priority_icons/high_v2.svg +14 -0
- package/src/assets/images/priority_icons/low.svg +10 -0
- package/src/assets/images/priority_icons/low_v2.svg +14 -0
- package/src/assets/images/priority_icons/medium.svg +16 -0
- package/src/assets/images/priority_icons/medium_v2.svg +11 -0
- package/src/assets/images/priority_icons/urgent.svg +4 -0
- package/src/assets/images/priority_icons/urgent_v2.svg +16 -0
- package/src/assets/js/chat21client.js +159 -84
- package/src/assets/logo.png +0 -0
- package/src/assets/tiledesk-solo-logo.png +0 -0
- package/src/assets/transparent.png +0 -0
- package/src/chat-config-mqtt.json +27 -17
- package/src/chat-config-pre-test.json +6 -2
- package/src/chat-config-template.json +8 -1
- package/src/chat-config.json +8 -1
- package/src/chat21-core/providers/chat-manager.ts +3 -3
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +6 -6
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +61 -45
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +24 -1
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +32 -24
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
- package/src/chat21-core/utils/constants.ts +8 -1
- package/src/chat21-core/utils/utils-message.ts +21 -2
- package/src/chat21-core/utils/utils.ts +13 -2
- package/src/firebase-messaging-sw-template.js +1 -1
- package/src/global.scss +408 -2
- package/src/index.html +7 -0
- package/publish_pre.sh +0 -33
- package/publish_prod.sh +0 -33
- 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/assets/images/tiledesk_logo_50x50.png +0 -0
|
@@ -1,37 +1,49 @@
|
|
|
1
|
-
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
|
|
2
|
-
import { Component, OnInit, ViewChild } from '@angular/core'
|
|
3
|
-
import { IonContent, ModalController } from '@ionic/angular'
|
|
4
|
-
import { ActivatedRoute, Router, NavigationExtras } from '@angular/router'
|
|
1
|
+
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
|
|
2
|
+
import { Component, OnInit, ViewChild } from '@angular/core'
|
|
3
|
+
import { IonContent, ModalController } from '@ionic/angular'
|
|
4
|
+
import { ActivatedRoute, Router, NavigationExtras } from '@angular/router'
|
|
5
5
|
// config
|
|
6
|
-
import { environment } from '../../../environments/environment'
|
|
6
|
+
import { environment } from '../../../environments/environment'
|
|
7
7
|
|
|
8
8
|
// models
|
|
9
|
-
import { ConversationModel } from 'src/chat21-core/models/conversation'
|
|
10
|
-
import { UserModel } from 'src/chat21-core/models/user'
|
|
9
|
+
import { ConversationModel } from 'src/chat21-core/models/conversation'
|
|
10
|
+
import { UserModel } from 'src/chat21-core/models/user'
|
|
11
11
|
|
|
12
12
|
// utils
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import {
|
|
14
|
+
isInArray,
|
|
15
|
+
checkPlatformIsMobile,
|
|
16
|
+
presentModal,
|
|
17
|
+
closeModal,
|
|
18
|
+
convertMessage,
|
|
19
|
+
isGroup,
|
|
20
|
+
} from '../../../chat21-core/utils/utils'
|
|
21
|
+
|
|
22
|
+
import { EventsService } from '../../services/events-service'
|
|
23
|
+
import PerfectScrollbar from 'perfect-scrollbar' // https://github.com/mdbootstrap/perfect-scrollbar
|
|
17
24
|
|
|
18
25
|
// services
|
|
19
|
-
import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service'
|
|
20
|
-
import { ChatManager } from 'src/chat21-core/providers/chat-manager'
|
|
21
|
-
import { NavProxyService } from '../../services/nav-proxy.service'
|
|
22
|
-
import { TiledeskService } from '../../services/tiledesk/tiledesk.service'
|
|
23
|
-
import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page'
|
|
24
|
-
import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page'
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
26
|
+
import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service'
|
|
27
|
+
import { ChatManager } from 'src/chat21-core/providers/chat-manager'
|
|
28
|
+
import { NavProxyService } from '../../services/nav-proxy.service'
|
|
29
|
+
import { TiledeskService } from '../../services/tiledesk/tiledesk.service'
|
|
30
|
+
import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page'
|
|
31
|
+
import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page'
|
|
32
|
+
import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page'
|
|
33
|
+
import { ProfileInfoPage } from '../profile-info/profile-info.page'
|
|
34
|
+
import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service'
|
|
35
|
+
import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service'
|
|
36
|
+
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
|
|
37
|
+
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service'
|
|
38
|
+
import { AppConfigProvider } from '../../services/app-config'
|
|
39
|
+
import { Subscription } from 'rxjs'
|
|
40
|
+
import { Platform } from '@ionic/angular'
|
|
32
41
|
// Logger
|
|
33
|
-
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service'
|
|
34
|
-
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
42
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service'
|
|
43
|
+
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
44
|
+
import { NetworkService } from 'src/app/services/network-service/network.service'
|
|
45
|
+
import { Subject } from 'rxjs'
|
|
46
|
+
import { takeUntil } from 'rxjs/operators'
|
|
35
47
|
|
|
36
48
|
@Component({
|
|
37
49
|
selector: 'app-conversations-list',
|
|
@@ -39,29 +51,54 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
|
39
51
|
styleUrls: ['./conversations-list.page.scss'],
|
|
40
52
|
})
|
|
41
53
|
export class ConversationListPage implements OnInit {
|
|
42
|
-
@ViewChild('ioncontentconvlist', { static: false })
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
public
|
|
48
|
-
public
|
|
49
|
-
public
|
|
50
|
-
public
|
|
51
|
-
public
|
|
52
|
-
public
|
|
53
|
-
public
|
|
54
|
-
public
|
|
55
|
-
|
|
56
|
-
public
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
@ViewChild('ioncontentconvlist', { static: false })
|
|
55
|
+
ionContentConvList: IonContent
|
|
56
|
+
|
|
57
|
+
private unsubscribe$: Subject<any> = new Subject<any>()
|
|
58
|
+
private subscriptions: Array<string>
|
|
59
|
+
public tenant: string
|
|
60
|
+
public loggedUserUid: string
|
|
61
|
+
public conversations: Array<ConversationModel> = []
|
|
62
|
+
public archivedConversations: Array<ConversationModel> = []
|
|
63
|
+
public uidConvSelected: string
|
|
64
|
+
public conversationSelected: ConversationModel
|
|
65
|
+
public uidReciverFromUrl: string
|
|
66
|
+
public showPlaceholder = true
|
|
67
|
+
public numberOpenConv = 0
|
|
68
|
+
public loadingIsActive = true
|
|
69
|
+
public supportMode: boolean
|
|
70
|
+
public writeto_btn: boolean
|
|
71
|
+
public archived_btn: boolean
|
|
72
|
+
public convertMessage = convertMessage
|
|
73
|
+
private isShowMenuPage = false
|
|
74
|
+
private logger: LoggerService = LoggerInstance.getInstance()
|
|
75
|
+
translationMapConversation: Map<string, string>
|
|
76
|
+
stylesMap: Map<string, string>
|
|
61
77
|
|
|
62
78
|
public conversationType = 'active'
|
|
63
|
-
headerTitle: string
|
|
64
|
-
|
|
79
|
+
headerTitle: string
|
|
80
|
+
subscription: Subscription
|
|
81
|
+
|
|
82
|
+
public UNASSIGNED_CONVS_URL: any
|
|
83
|
+
public PROJECTS_FOR_PANEL_URL: any
|
|
84
|
+
public IFRAME_URL: any
|
|
85
|
+
public hasClickedOpenUnservedConvIframe: boolean = false
|
|
86
|
+
public lastProjectId: string
|
|
87
|
+
public isOnline: boolean = true
|
|
88
|
+
public checkInternet: boolean
|
|
89
|
+
|
|
90
|
+
public displayNewConvsItem: boolean = true
|
|
91
|
+
public archiveActionNotAllowed: boolean = false
|
|
92
|
+
|
|
93
|
+
tooltipOptions = {
|
|
94
|
+
'show-delay': 1500,
|
|
95
|
+
'tooltip-class': 'chat-tooltip',
|
|
96
|
+
theme: 'light',
|
|
97
|
+
shadow: false,
|
|
98
|
+
'hide-delay-mobile': 0,
|
|
99
|
+
hideDelayAfterClick: 3000,
|
|
100
|
+
'hide-delay': 200,
|
|
101
|
+
}
|
|
65
102
|
|
|
66
103
|
constructor(
|
|
67
104
|
private router: Router,
|
|
@@ -78,154 +115,464 @@ export class ConversationListPage implements OnInit {
|
|
|
78
115
|
private translateService: CustomTranslateService,
|
|
79
116
|
public tiledeskService: TiledeskService,
|
|
80
117
|
public tiledeskAuthService: TiledeskAuthService,
|
|
81
|
-
public appConfigProvider: AppConfigProvider
|
|
118
|
+
public appConfigProvider: AppConfigProvider,
|
|
119
|
+
public platform: Platform,
|
|
120
|
+
private networkService: NetworkService,
|
|
82
121
|
) {
|
|
83
|
-
this.listenToAppCompConvsLengthOnInitConvs()
|
|
84
|
-
this.listenToLogoutEvent()
|
|
85
|
-
this.
|
|
122
|
+
this.listenToAppCompConvsLengthOnInitConvs()
|
|
123
|
+
this.listenToLogoutEvent()
|
|
124
|
+
this.listenGoOnline()
|
|
125
|
+
this.listenGoOffline()
|
|
126
|
+
this.listenToSwPostMessage()
|
|
127
|
+
this.listenSupportConvIdHasChanged()
|
|
128
|
+
// this.listenDirectConvIdHasChanged();
|
|
129
|
+
this.listenToCloseConvFromHeaderConversation()
|
|
130
|
+
}
|
|
86
131
|
|
|
132
|
+
listenSupportConvIdHasChanged() {
|
|
133
|
+
this.events.subscribe('supportconvid:haschanged', (IDConv) => {
|
|
134
|
+
// console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', IDConv);
|
|
135
|
+
if (IDConv) {
|
|
136
|
+
// const conversationSelected = this.conversations.find(item => item.uid === convId);
|
|
137
|
+
// this.onConversationSelected(conversationSelected)
|
|
138
|
+
this.setUidConvSelected(IDConv, 'active')
|
|
139
|
+
}
|
|
140
|
+
if (!IDConv) {
|
|
141
|
+
this.logger.log(
|
|
142
|
+
'[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select',
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
const chatTabCount = +localStorage.getItem('tabCount')
|
|
146
|
+
this.logger.log(
|
|
147
|
+
'[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ',
|
|
148
|
+
chatTabCount,
|
|
149
|
+
)
|
|
150
|
+
if (chatTabCount && chatTabCount > 0) {
|
|
151
|
+
this.logger.log(
|
|
152
|
+
'[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ',
|
|
153
|
+
chatTabCount,
|
|
154
|
+
)
|
|
155
|
+
if (checkPlatformIsMobile()) {
|
|
156
|
+
this.logger.log(
|
|
157
|
+
'[CONVS-LIST-PAGE] - the chat is in mobile mode ',
|
|
158
|
+
checkPlatformIsMobile(),
|
|
159
|
+
)
|
|
160
|
+
this.events.publish('noparams:mobile', true)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
})
|
|
87
165
|
}
|
|
88
166
|
|
|
167
|
+
// listenDirectConvIdHasChanged() {
|
|
168
|
+
// this.events.subscribe('directconvid:haschanged', (contact_id) => {
|
|
169
|
+
// // console.log('[CONVS-LIST-PAGE] - listen To directconvid:haschanged - contact_id', contact_id);
|
|
170
|
+
// if (contact_id) {
|
|
171
|
+
// this.uidConvSelected = contact_id
|
|
172
|
+
// }
|
|
173
|
+
// });
|
|
174
|
+
// }
|
|
89
175
|
|
|
90
176
|
// -----------------------------------------------
|
|
91
177
|
// @ Lifehooks
|
|
92
178
|
// -----------------------------------------------
|
|
93
179
|
ngOnInit() {
|
|
180
|
+
this.watchToConnectionStatus()
|
|
181
|
+
this.getAppConfigToHideDiplayBtns()
|
|
182
|
+
|
|
183
|
+
// const currentUrl = this.router.url;
|
|
184
|
+
// this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
|
|
185
|
+
// this.route.queryParams.subscribe(params => {
|
|
186
|
+
// this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
|
|
187
|
+
// if (params && params.convId) {
|
|
188
|
+
// console.log('[CONVS-LIST-PAGE] ngOnInit params convId:', params.convId);
|
|
189
|
+
|
|
190
|
+
// const conversationSelected = this.conversations.find(item => item.uid === params.convId);
|
|
191
|
+
// if (conversationSelected) {
|
|
192
|
+
// this.conversationSelected = conversationSelected;
|
|
193
|
+
// console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
|
|
194
|
+
// setTimeout(() => {
|
|
195
|
+
// // this.navigateByUrl('active', params.convId)
|
|
196
|
+
// }, 0);
|
|
197
|
+
// }
|
|
198
|
+
|
|
199
|
+
// } else {
|
|
200
|
+
// console.log('[CONVS-LIST-PAGE] ngOnInit params No convId Params ');
|
|
201
|
+
// }
|
|
202
|
+
// if (params && params.contact_id && params.contact_fullname) {
|
|
203
|
+
// this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
|
|
204
|
+
// setTimeout(() => {
|
|
205
|
+
// this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
|
|
206
|
+
// }, 0);
|
|
207
|
+
// this.uidConvSelected = params.contact_id
|
|
208
|
+
// } else {
|
|
209
|
+
// this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No contact_id and contact_fullname Params ');
|
|
210
|
+
// }
|
|
211
|
+
|
|
212
|
+
// if (params && params.conversation_detail) {
|
|
213
|
+
// this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
|
|
214
|
+
// setTimeout(() => {
|
|
215
|
+
// this.router.navigateByUrl('conversation-detail/');
|
|
216
|
+
// }, 0);
|
|
217
|
+
// } else {
|
|
218
|
+
// this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No conversation_detail Params ');
|
|
219
|
+
// }
|
|
94
220
|
|
|
221
|
+
// });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
ngOnChanges() {
|
|
225
|
+
this.getConversationListHeight()
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
getConversationListHeight() {
|
|
229
|
+
var scrollbar2element = document.getElementById('scrollbar2')
|
|
230
|
+
this.logger.log('[CONVS-LIST-PAGE] getConversationListHeight scrollbar2element', scrollbar2element)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// this.support_mode = null
|
|
234
|
+
// if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
|
|
235
|
+
// this.support_mode = true
|
|
236
|
+
// } else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
|
|
237
|
+
// this.support_mode = false
|
|
238
|
+
// } else if ( !this.appConfigProvider.getConfig().supportMode ) {
|
|
239
|
+
// this.support_mode = false
|
|
240
|
+
// }
|
|
241
|
+
|
|
242
|
+
getAppConfigToHideDiplayBtns() {
|
|
243
|
+
const appConfig = this.appConfigProvider.getConfig()
|
|
244
|
+
// console.log('[CONVS-LIST-PAGE] - appConfig ', appConfig)
|
|
245
|
+
this.supportMode = null
|
|
246
|
+
if (appConfig && appConfig.supportMode === true || appConfig.supportMode === 'true') {
|
|
247
|
+
this.supportMode = true;
|
|
248
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
|
|
249
|
+
} else if (appConfig && appConfig.supportMode === false || appConfig.supportMode === 'false') {
|
|
250
|
+
this.supportMode = false
|
|
251
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
|
|
252
|
+
}
|
|
253
|
+
this.archived_btn = null
|
|
254
|
+
if (appConfig && appConfig.archivedButton === true || appConfig.archivedButton === 'true') {
|
|
255
|
+
this.archived_btn = true;
|
|
256
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
|
|
257
|
+
} else if (appConfig && appConfig.archivedButton === false || appConfig.archivedButton === 'false') {
|
|
258
|
+
this.archived_btn = false;
|
|
259
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
|
|
260
|
+
}
|
|
261
|
+
this.writeto_btn = null
|
|
262
|
+
if (appConfig && appConfig.writeToButton === true || appConfig.writeToButton === 'true') {
|
|
263
|
+
this.writeto_btn = true;
|
|
264
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
|
|
265
|
+
} else if (appConfig && appConfig.writeToButton === false || appConfig.writeToButton === 'false') {
|
|
266
|
+
this.writeto_btn = false;
|
|
267
|
+
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
|
|
268
|
+
}
|
|
269
|
+
// console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
watchToConnectionStatus() {
|
|
273
|
+
this.networkService.checkInternetFunc().subscribe((isOnline) => {
|
|
274
|
+
this.checkInternet = isOnline
|
|
275
|
+
this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
276
|
+
|
|
277
|
+
// checking internet connection
|
|
278
|
+
if (this.checkInternet == true) {
|
|
279
|
+
this.isOnline = true
|
|
280
|
+
} else {
|
|
281
|
+
this.isOnline = false
|
|
282
|
+
}
|
|
283
|
+
})
|
|
95
284
|
}
|
|
96
285
|
|
|
97
286
|
ionViewWillEnter() {
|
|
98
|
-
this.logger.log('
|
|
99
|
-
this.
|
|
287
|
+
this.logger.log('Called ionViewDidEnter')
|
|
288
|
+
this.logger.log(
|
|
289
|
+
'[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',
|
|
290
|
+
this.uidConvSelected,
|
|
291
|
+
)
|
|
292
|
+
this.listnerStart()
|
|
293
|
+
|
|
294
|
+
// exit from app with hardware back button
|
|
295
|
+
this.subscription = this.platform.backButton.subscribe(() => {
|
|
296
|
+
navigator['app'].exitApp()
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// unsubscribe backButton.subscribe method to not use from other page
|
|
301
|
+
ionViewWillLeave() {
|
|
302
|
+
this.logger.log('Called ionViewWillLeave')
|
|
303
|
+
this.subscription.unsubscribe()
|
|
100
304
|
}
|
|
101
305
|
|
|
102
306
|
ionViewDidEnter() { }
|
|
103
307
|
|
|
308
|
+
getLastProjectId(projectid: string) {
|
|
309
|
+
this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid)
|
|
310
|
+
this.lastProjectId = projectid
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
openUnsevedConversationIframe(event) {
|
|
314
|
+
this.logger.log('[CONVS-LIST-PAGE] openUnsevedConversationIframe ', event)
|
|
315
|
+
this.hasClickedOpenUnservedConvIframe = true
|
|
316
|
+
this.logger.log(
|
|
317
|
+
'[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME',
|
|
318
|
+
this.hasClickedOpenUnservedConvIframe,
|
|
319
|
+
)
|
|
320
|
+
const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl
|
|
321
|
+
// http://localhost:4204/#/projects-for-panel
|
|
322
|
+
this.PROJECTS_FOR_PANEL_URL = DASHBOARD_BASE_URL + '#/projects-for-panel'
|
|
323
|
+
this.UNASSIGNED_CONVS_URL =
|
|
324
|
+
DASHBOARD_BASE_URL +
|
|
325
|
+
'#/project/' +
|
|
326
|
+
this.lastProjectId +
|
|
327
|
+
'/unserved-request-for-panel'
|
|
328
|
+
|
|
329
|
+
if (event === 'pinbtn') {
|
|
330
|
+
this.IFRAME_URL = this.PROJECTS_FOR_PANEL_URL
|
|
331
|
+
} else {
|
|
332
|
+
this.IFRAME_URL = this.UNASSIGNED_CONVS_URL
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
this.logger.log(
|
|
336
|
+
'[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL',
|
|
337
|
+
this.UNASSIGNED_CONVS_URL,
|
|
338
|
+
)
|
|
339
|
+
this.openUnassignedConversations(this.IFRAME_URL, event)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// ---------------------------------------------------------
|
|
343
|
+
// Opens the Unassigned Conversations iframe
|
|
344
|
+
// ---------------------------------------------------------
|
|
345
|
+
openUnassignedConversations(IFRAME_URL: string, event) {
|
|
346
|
+
if (checkPlatformIsMobile()) {
|
|
347
|
+
presentModal(this.modalController, UnassignedConversationsPage, {
|
|
348
|
+
iframe_URL: IFRAME_URL,
|
|
349
|
+
callerBtn: event,
|
|
350
|
+
})
|
|
351
|
+
} else {
|
|
352
|
+
this.navService.push(UnassignedConversationsPage, {
|
|
353
|
+
iframe_URL: IFRAME_URL,
|
|
354
|
+
callerBtn: event,
|
|
355
|
+
})
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
_closeContactsDirectory() {
|
|
360
|
+
try {
|
|
361
|
+
closeModal(this.modalController)
|
|
362
|
+
} catch (err) {
|
|
363
|
+
this.logger.error(
|
|
364
|
+
'[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
|
|
365
|
+
err,
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
104
370
|
listenToSwPostMessage() {
|
|
105
|
-
this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ')
|
|
106
|
-
const that = this
|
|
371
|
+
this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ')
|
|
372
|
+
const that = this
|
|
107
373
|
if (navigator && navigator.serviceWorker) {
|
|
108
|
-
|
|
109
374
|
navigator.serviceWorker.addEventListener('message', function (event) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
375
|
+
that.logger.log(
|
|
376
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ',
|
|
377
|
+
event.data,
|
|
378
|
+
)
|
|
379
|
+
that.logger.log(
|
|
380
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ',
|
|
381
|
+
event.data['data'],
|
|
382
|
+
)
|
|
383
|
+
that.logger.log(
|
|
384
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ',
|
|
385
|
+
typeof event.data['data'],
|
|
386
|
+
)
|
|
114
387
|
let uidConvSelected = ''
|
|
115
388
|
if (event.data && event.data['conversWith']) {
|
|
116
|
-
uidConvSelected = event.data['conversWith']
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
389
|
+
uidConvSelected = event.data['conversWith']
|
|
390
|
+
} else {
|
|
391
|
+
that.logger.log(
|
|
392
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG',
|
|
393
|
+
)
|
|
394
|
+
return
|
|
121
395
|
}
|
|
122
396
|
|
|
123
|
-
that.logger.log(
|
|
124
|
-
|
|
125
|
-
|
|
397
|
+
that.logger.log(
|
|
398
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ',
|
|
399
|
+
uidConvSelected,
|
|
400
|
+
)
|
|
401
|
+
that.logger.log(
|
|
402
|
+
'[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ',
|
|
403
|
+
that.conversations,
|
|
404
|
+
)
|
|
405
|
+
const conversationSelected = that.conversations.find(
|
|
406
|
+
(item) => item.uid === uidConvSelected,
|
|
407
|
+
)
|
|
126
408
|
if (conversationSelected) {
|
|
127
|
-
|
|
128
|
-
that.
|
|
129
|
-
|
|
409
|
+
that.conversationSelected = conversationSelected
|
|
410
|
+
that.logger.log(
|
|
411
|
+
'[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ',
|
|
412
|
+
that.conversationSelected,
|
|
413
|
+
)
|
|
130
414
|
|
|
131
415
|
that.navigateByUrl('active', uidConvSelected)
|
|
132
416
|
}
|
|
133
|
-
})
|
|
417
|
+
})
|
|
134
418
|
}
|
|
135
419
|
}
|
|
136
420
|
|
|
137
|
-
|
|
138
421
|
private listnerStart() {
|
|
139
|
-
const that = this
|
|
140
|
-
this.chatManager.BSStart.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
422
|
+
const that = this
|
|
423
|
+
this.chatManager.BSStart.pipe(takeUntil(that.unsubscribe$)).subscribe(
|
|
424
|
+
(data: any) => {
|
|
425
|
+
this.logger.log(
|
|
426
|
+
'[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****',
|
|
427
|
+
data,
|
|
428
|
+
)
|
|
429
|
+
if (data) {
|
|
430
|
+
that.initialize()
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
(error) => {
|
|
434
|
+
this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error)
|
|
435
|
+
},
|
|
436
|
+
() => {
|
|
437
|
+
this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
|
|
438
|
+
},
|
|
439
|
+
)
|
|
146
440
|
}
|
|
147
441
|
|
|
148
|
-
|
|
149
442
|
// ------------------------------------------------------------------ //
|
|
150
443
|
// Init convrsation handler
|
|
151
444
|
// ------------------------------------------------------------------ //
|
|
152
445
|
initConversationsHandler() {
|
|
153
|
-
this.conversations = this.conversationsHandlerService.conversations
|
|
446
|
+
this.conversations = this.conversationsHandlerService.conversations
|
|
154
447
|
this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations)
|
|
155
448
|
// save conversationHandler in chatManager
|
|
156
|
-
this.chatManager.setConversationsHandler(this.conversationsHandlerService)
|
|
157
|
-
this.showPlaceholder = false
|
|
449
|
+
this.chatManager.setConversationsHandler(this.conversationsHandlerService)
|
|
450
|
+
this.showPlaceholder = false
|
|
158
451
|
}
|
|
159
452
|
|
|
160
|
-
|
|
161
|
-
|
|
162
453
|
initArchivedConversationsHandler() {
|
|
163
|
-
const keysConversation = ['CLOSED']
|
|
164
|
-
this.translationMapConversation = this.translateService.translateLanguage(
|
|
454
|
+
const keysConversation = ['CLOSED', 'Resolve']
|
|
455
|
+
this.translationMapConversation = this.translateService.translateLanguage(
|
|
456
|
+
keysConversation,
|
|
457
|
+
)
|
|
165
458
|
|
|
166
459
|
this.archivedConversationsHandlerService.subscribeToConversations(() => {
|
|
167
|
-
this.logger.log(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
460
|
+
this.logger.log(
|
|
461
|
+
'[CONVS-LIST-PAGE]-CONVS - conversations archived length ',
|
|
462
|
+
this.archivedConversations.length,
|
|
463
|
+
)
|
|
464
|
+
})
|
|
465
|
+
|
|
466
|
+
this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations
|
|
467
|
+
this.logger.log(
|
|
468
|
+
'[CONVS-LIST-PAGE] archived conversation',
|
|
469
|
+
this.archivedConversations,
|
|
470
|
+
)
|
|
173
471
|
|
|
174
472
|
// save archivedConversationsHandlerService in chatManager
|
|
175
|
-
this.chatManager.setArchivedConversationsHandler(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
473
|
+
this.chatManager.setArchivedConversationsHandler(
|
|
474
|
+
this.archivedConversationsHandlerService,
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
this.logger.log(
|
|
478
|
+
'[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ',
|
|
479
|
+
this.archivedConversations.length,
|
|
480
|
+
)
|
|
481
|
+
if (
|
|
482
|
+
!this.archivedConversations ||
|
|
483
|
+
this.archivedConversations.length === 0
|
|
484
|
+
) {
|
|
485
|
+
this.loadingIsActive = false
|
|
180
486
|
}
|
|
181
|
-
|
|
182
487
|
}
|
|
183
488
|
|
|
184
|
-
|
|
185
489
|
// ----------------------------------------------------------------------------------------------------
|
|
186
|
-
// To display "No conversation yet" MESSAGE in conversazion list
|
|
490
|
+
// To display "No conversation yet" MESSAGE in conversazion list
|
|
187
491
|
// this.loadingIsActive is set to false only if on init there are not conversation
|
|
188
492
|
// otherwise loadingIsActive remains set to true and the message "No conversation yet" is not displayed
|
|
189
493
|
// to fix this
|
|
190
|
-
// - for the direct conversation
|
|
191
|
-
// ----------------------------------------------------------------------------------------------------
|
|
494
|
+
// - for the direct conversation
|
|
495
|
+
// ----------------------------------------------------------------------------------------------------
|
|
192
496
|
listenToAppCompConvsLengthOnInitConvs() {
|
|
193
|
-
this.events.subscribe(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
this.
|
|
497
|
+
this.events.subscribe(
|
|
498
|
+
'appcompSubscribeToConvs:loadingIsActive',
|
|
499
|
+
(loadingIsActive) => {
|
|
500
|
+
this.logger.log(
|
|
501
|
+
'[CONVS-LIST-PAGE]-CONVS loadingIsActive',
|
|
502
|
+
loadingIsActive,
|
|
503
|
+
)
|
|
504
|
+
if (loadingIsActive === false) {
|
|
505
|
+
this.loadingIsActive = false
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
)
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
listenGoOnline() {
|
|
512
|
+
this.events.subscribe('go:online', (goonline) => {
|
|
513
|
+
this.logger.info(
|
|
514
|
+
'[CONVS-LIST-PAGE] - listen To go:online - goonline',
|
|
515
|
+
goonline,
|
|
516
|
+
)
|
|
517
|
+
// this.events.unsubscribe('profileInfoButtonClick:logout')
|
|
518
|
+
if (goonline === true) {
|
|
519
|
+
this.displayNewConvsItem = true
|
|
197
520
|
}
|
|
198
|
-
})
|
|
521
|
+
})
|
|
199
522
|
}
|
|
200
523
|
|
|
201
|
-
|
|
202
|
-
this.events.subscribe('
|
|
203
|
-
this.logger.info(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (hasclickedlogout === true) {
|
|
211
|
-
this.loadingIsActive = false
|
|
524
|
+
listenGoOffline() {
|
|
525
|
+
this.events.subscribe('go:offline', (offline) => {
|
|
526
|
+
this.logger.info(
|
|
527
|
+
'[CONVS-LIST-PAGE] - listen To go:offline - offline',
|
|
528
|
+
offline,
|
|
529
|
+
)
|
|
530
|
+
// this.events.unsubscribe('profileInfoButtonClick:logout')
|
|
531
|
+
if (offline === true) {
|
|
532
|
+
this.displayNewConvsItem = false
|
|
212
533
|
}
|
|
213
|
-
})
|
|
534
|
+
})
|
|
214
535
|
}
|
|
215
536
|
|
|
537
|
+
listenToLogoutEvent() {
|
|
538
|
+
this.events.subscribe(
|
|
539
|
+
'profileInfoButtonClick:logout',
|
|
540
|
+
(hasclickedlogout) => {
|
|
541
|
+
this.logger.info(
|
|
542
|
+
'[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout',
|
|
543
|
+
hasclickedlogout,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
this.conversations = []
|
|
547
|
+
this.conversationsHandlerService.conversations = []
|
|
548
|
+
this.uidConvSelected = null
|
|
549
|
+
|
|
550
|
+
this.logger.log(
|
|
551
|
+
'[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ',
|
|
552
|
+
this.conversations,
|
|
553
|
+
)
|
|
554
|
+
this.logger.log(
|
|
555
|
+
'[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ',
|
|
556
|
+
this.uidConvSelected,
|
|
557
|
+
)
|
|
558
|
+
if (hasclickedlogout === true) {
|
|
559
|
+
this.loadingIsActive = false
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
)
|
|
563
|
+
}
|
|
216
564
|
|
|
217
|
-
// ------------------------------------------------------------------
|
|
565
|
+
// ------------------------------------------------------------------
|
|
218
566
|
// SUBSCRIPTIONS
|
|
219
567
|
// ------------------------------------------------------------------
|
|
220
568
|
initSubscriptions() {
|
|
221
569
|
this.logger.log('[CONVS-LIST-PAGE] - CALLING - initSubscriptions ')
|
|
222
|
-
let key = ''
|
|
223
|
-
|
|
570
|
+
let key = ''
|
|
224
571
|
|
|
225
|
-
key = 'loggedUser:logout'
|
|
572
|
+
key = 'loggedUser:logout'
|
|
226
573
|
if (!isInArray(key, this.subscriptions)) {
|
|
227
|
-
this.subscriptions.push(key)
|
|
228
|
-
this.events.subscribe(key, this.subscribeLoggedUserLogout)
|
|
574
|
+
this.subscriptions.push(key)
|
|
575
|
+
this.events.subscribe(key, this.subscribeLoggedUserLogout)
|
|
229
576
|
}
|
|
230
577
|
|
|
231
578
|
// key = 'readAllMessages';
|
|
@@ -234,10 +581,10 @@ export class ConversationListPage implements OnInit {
|
|
|
234
581
|
// this.events.subscribe(key, this.readAllMessages);
|
|
235
582
|
// }
|
|
236
583
|
|
|
237
|
-
key = 'profileInfoButtonClick:changed'
|
|
584
|
+
key = 'profileInfoButtonClick:changed'
|
|
238
585
|
if (!isInArray(key, this.subscriptions)) {
|
|
239
|
-
this.subscriptions.push(key)
|
|
240
|
-
this.events.subscribe(key, this.subscribeProfileInfoButtonClicked)
|
|
586
|
+
this.subscriptions.push(key)
|
|
587
|
+
this.events.subscribe(key, this.subscribeProfileInfoButtonClicked)
|
|
241
588
|
}
|
|
242
589
|
|
|
243
590
|
// this.conversationsHandlerService.readAllMessages.subscribe((conversationId: string) => {
|
|
@@ -245,81 +592,119 @@ export class ConversationListPage implements OnInit {
|
|
|
245
592
|
// this.readAllMessages(conversationId);
|
|
246
593
|
// });
|
|
247
594
|
|
|
248
|
-
this.conversationsHandlerService.conversationAdded.subscribe(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
595
|
+
this.conversationsHandlerService.conversationAdded.subscribe(
|
|
596
|
+
(conversation: ConversationModel) => {
|
|
597
|
+
// this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
|
|
598
|
+
// that.conversationsChanged(conversations);
|
|
599
|
+
if (conversation) {
|
|
600
|
+
this.onImageLoaded(conversation)
|
|
601
|
+
this.onConversationLoaded(conversation)
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
this.conversationsHandlerService.conversationChanged.subscribe(
|
|
607
|
+
(conversation: ConversationModel) => {
|
|
608
|
+
// this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
|
|
609
|
+
// that.conversationsChanged(conversations)
|
|
610
|
+
if (conversation) {
|
|
611
|
+
this.onImageLoaded(conversation)
|
|
612
|
+
this.onConversationLoaded(conversation)
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
this.conversationsHandlerService.conversationRemoved.subscribe(
|
|
618
|
+
(conversation: ConversationModel) => {
|
|
619
|
+
this.logger.log(
|
|
620
|
+
'[CONVS-LIST-PAGE] ***** conversationsRemoved *****',
|
|
621
|
+
conversation,
|
|
622
|
+
)
|
|
623
|
+
},
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
this.archivedConversationsHandlerService.archivedConversationAdded.subscribe(
|
|
627
|
+
(conversation: ConversationModel) => {
|
|
628
|
+
this.logger.log(
|
|
629
|
+
'[CONVS-LIST-PAGE] ***** archivedConversationAdded *****',
|
|
630
|
+
conversation,
|
|
631
|
+
)
|
|
632
|
+
// that.conversationsChanged(conversations);
|
|
633
|
+
if (conversation) {
|
|
634
|
+
this.onImageLoaded(conversation)
|
|
635
|
+
this.onConversationLoaded(conversation)
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
)
|
|
278
639
|
}
|
|
279
640
|
|
|
280
641
|
// ------------------------------------------------------------------------------------
|
|
281
642
|
// @ SUBSCRIBE TO LOGGED USER LOGOUT ??????????? SEEMS NOT USED ?????????????????
|
|
282
643
|
// ------------------------------------------------------------------------------------
|
|
283
644
|
subscribeLoggedUserLogout = () => {
|
|
284
|
-
this.conversations = []
|
|
285
|
-
this.uidConvSelected = null
|
|
286
|
-
this.logger.log(
|
|
287
|
-
|
|
645
|
+
this.conversations = []
|
|
646
|
+
this.uidConvSelected = null
|
|
647
|
+
this.logger.log(
|
|
648
|
+
'[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ',
|
|
649
|
+
this.conversations,
|
|
650
|
+
)
|
|
651
|
+
this.logger.log(
|
|
652
|
+
'[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',
|
|
653
|
+
this.uidConvSelected,
|
|
654
|
+
)
|
|
288
655
|
}
|
|
289
656
|
|
|
290
|
-
|
|
291
|
-
|
|
292
657
|
// ------------------------------------------------------------------------------------
|
|
293
658
|
// @ SUBSCRIBE TO CONVERSATION CHANGED ??????????? SEEMS NOT USED ?????????????????
|
|
294
659
|
// ------------------------------------------------------------------------------------
|
|
295
660
|
conversationsChanged = (conversations: ConversationModel[]) => {
|
|
296
|
-
this.numberOpenConv = this.conversationsHandlerService.countIsNew()
|
|
297
|
-
this.logger.log(
|
|
661
|
+
this.numberOpenConv = this.conversationsHandlerService.countIsNew()
|
|
662
|
+
this.logger.log(
|
|
663
|
+
'[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',
|
|
664
|
+
this.numberOpenConv,
|
|
665
|
+
)
|
|
298
666
|
// console.log('conversationsChanged »»»»»»»»» uidConvSelected', that.conversations[0], that.uidConvSelected);
|
|
299
667
|
if (this.uidConvSelected && !this.conversationSelected) {
|
|
300
|
-
const conversationSelected = this.conversations.find(
|
|
668
|
+
const conversationSelected = this.conversations.find(
|
|
669
|
+
(item) => item.uid === this.uidConvSelected,
|
|
670
|
+
)
|
|
301
671
|
if (conversationSelected) {
|
|
302
|
-
this.conversationSelected = conversationSelected
|
|
303
|
-
this.setUidConvSelected(this.uidConvSelected)
|
|
672
|
+
this.conversationSelected = conversationSelected
|
|
673
|
+
this.setUidConvSelected(this.uidConvSelected)
|
|
304
674
|
}
|
|
305
675
|
}
|
|
306
676
|
}
|
|
307
677
|
|
|
308
|
-
|
|
309
678
|
/**
|
|
310
679
|
* ::: subscribeChangedConversationSelected :::
|
|
311
680
|
* evento richiamato quando si seleziona un utente nell'elenco degli user
|
|
312
681
|
* apro dettaglio conversazione
|
|
313
682
|
*/
|
|
683
|
+
// --------------------------------
|
|
684
|
+
// !!!!!! IS USED? ?????
|
|
685
|
+
// ------------------------------
|
|
314
686
|
subscribeChangedConversationSelected = (user: UserModel, type: string) => {
|
|
315
|
-
this.logger.log(
|
|
316
|
-
|
|
317
|
-
|
|
687
|
+
this.logger.log(
|
|
688
|
+
'[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',
|
|
689
|
+
user,
|
|
690
|
+
type,
|
|
691
|
+
)
|
|
692
|
+
this.uidConvSelected = user.uid
|
|
693
|
+
this.logger.log(
|
|
694
|
+
'[CONVS-LIST-PAGE] ************** uidConvSelected ',
|
|
695
|
+
this.uidConvSelected,
|
|
696
|
+
)
|
|
318
697
|
// this.conversationsHandlerService.uidConvSelected = user.uid;
|
|
319
|
-
const conversationSelected = this.conversations.find(
|
|
698
|
+
const conversationSelected = this.conversations.find(
|
|
699
|
+
(item) => item.uid === this.uidConvSelected,
|
|
700
|
+
)
|
|
320
701
|
if (conversationSelected) {
|
|
321
|
-
this.logger.log(
|
|
322
|
-
|
|
702
|
+
this.logger.log(
|
|
703
|
+
'[CONVS-LIST-PAGE] --> uidConvSelected: ',
|
|
704
|
+
this.conversationSelected,
|
|
705
|
+
this.uidConvSelected,
|
|
706
|
+
)
|
|
707
|
+
this.conversationSelected = conversationSelected
|
|
323
708
|
}
|
|
324
709
|
// this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
|
|
325
710
|
}
|
|
@@ -329,20 +714,28 @@ export class ConversationListPage implements OnInit {
|
|
|
329
714
|
* evento richiamato quando si seleziona bottone profile-info-modal
|
|
330
715
|
*/
|
|
331
716
|
subscribeProfileInfoButtonClicked = (event: string) => {
|
|
332
|
-
this.logger.log(
|
|
717
|
+
this.logger.log(
|
|
718
|
+
'[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ',
|
|
719
|
+
event,
|
|
720
|
+
)
|
|
333
721
|
if (event === 'displayArchived') {
|
|
334
|
-
this.initArchivedConversationsHandler()
|
|
722
|
+
this.initArchivedConversationsHandler()
|
|
335
723
|
// this.openArchivedConversationsModal()
|
|
336
724
|
this.conversationType = 'archived'
|
|
337
725
|
|
|
338
726
|
// let storedArchivedConv = localStorage.getItem('activeConversationSelected');
|
|
339
|
-
const keys = ['LABEL_ARCHIVED']
|
|
340
|
-
|
|
727
|
+
const keys = ['LABEL_ARCHIVED']
|
|
728
|
+
// const keys = ['History'];
|
|
341
729
|
|
|
730
|
+
this.headerTitle = this.translateService
|
|
731
|
+
.translateLanguage(keys)
|
|
732
|
+
.get(keys[0])
|
|
342
733
|
} else if (event === 'displayContact') {
|
|
343
734
|
this.conversationType = 'archived'
|
|
344
|
-
const keys = ['LABEL_CONTACTS']
|
|
345
|
-
this.headerTitle = this.translateService
|
|
735
|
+
const keys = ['LABEL_CONTACTS']
|
|
736
|
+
this.headerTitle = this.translateService
|
|
737
|
+
.translateLanguage(keys)
|
|
738
|
+
.get(keys[0])
|
|
346
739
|
}
|
|
347
740
|
}
|
|
348
741
|
|
|
@@ -356,12 +749,10 @@ export class ConversationListPage implements OnInit {
|
|
|
356
749
|
// console.log('ConversationListPage - storedActiveConv Objct: ', storedActiveConvObjct);
|
|
357
750
|
// this.navigateByUrl('active', storedActiveConvObjct.uid)
|
|
358
751
|
// } else {
|
|
359
|
-
// // da implementare se nn c'è stata nessuna conv attive selezionata
|
|
752
|
+
// // da implementare se nn c'è stata nessuna conv attive selezionata
|
|
360
753
|
// }
|
|
361
|
-
|
|
362
754
|
}
|
|
363
755
|
|
|
364
|
-
|
|
365
756
|
// ------------------------------------------------------------------//
|
|
366
757
|
// END SUBSCRIPTIONS
|
|
367
758
|
// ------------------------------------------------------------------//
|
|
@@ -383,8 +774,6 @@ export class ConversationListPage implements OnInit {
|
|
|
383
774
|
// })
|
|
384
775
|
// }
|
|
385
776
|
|
|
386
|
-
|
|
387
|
-
|
|
388
777
|
// ------------------------------------------------------------------//
|
|
389
778
|
// BEGIN FUNCTIONS
|
|
390
779
|
// ------------------------------------------------------------------//
|
|
@@ -392,19 +781,24 @@ export class ConversationListPage implements OnInit {
|
|
|
392
781
|
* ::: initialize :::
|
|
393
782
|
*/
|
|
394
783
|
initialize() {
|
|
395
|
-
const appconfig = this.appConfigProvider.getConfig()
|
|
396
|
-
this.tenant = appconfig.firebaseConfig.tenant
|
|
397
|
-
this.logger.log(
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
this.
|
|
403
|
-
|
|
784
|
+
const appconfig = this.appConfigProvider.getConfig()
|
|
785
|
+
this.tenant = appconfig.firebaseConfig.tenant
|
|
786
|
+
this.logger.log(
|
|
787
|
+
'[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ',
|
|
788
|
+
this.tenant,
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
if (this.tiledeskAuthService.getCurrentUser()) {
|
|
792
|
+
this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid
|
|
793
|
+
}
|
|
794
|
+
this.subscriptions = []
|
|
795
|
+
this.initConversationsHandler()
|
|
796
|
+
this.initVariables()
|
|
797
|
+
this.initSubscriptions()
|
|
798
|
+
|
|
404
799
|
// this.initHandlerEventEmitter();
|
|
405
800
|
}
|
|
406
801
|
|
|
407
|
-
|
|
408
802
|
/**
|
|
409
803
|
* ::: initVariables :::
|
|
410
804
|
* al caricamento della pagina:
|
|
@@ -419,129 +813,124 @@ export class ConversationListPage implements OnInit {
|
|
|
419
813
|
// It only works on BSStart.subscribe! it is useful or can be eliminated
|
|
420
814
|
// --------------------------------------------------------
|
|
421
815
|
initVariables() {
|
|
422
|
-
this.logger.log(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
816
|
+
this.logger.log(
|
|
817
|
+
'[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl,
|
|
818
|
+
)
|
|
819
|
+
this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid)
|
|
820
|
+
this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant)
|
|
821
|
+
if (this.route.component['name'] !== 'ConversationListPage') {
|
|
427
822
|
if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
|
|
428
|
-
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv')
|
|
429
|
-
this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv)
|
|
823
|
+
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv')
|
|
824
|
+
this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv)
|
|
430
825
|
if (IDConv) {
|
|
431
|
-
this.setUidConvSelected(IDConv)
|
|
826
|
+
this.setUidConvSelected(IDConv)
|
|
432
827
|
} else {
|
|
433
|
-
|
|
434
|
-
|
|
828
|
+
this.logger.log(
|
|
829
|
+
'[CONVS-LIST-PAGE] conversationWith 2 (else): ',
|
|
830
|
+
IDConv,
|
|
831
|
+
)
|
|
435
832
|
}
|
|
436
833
|
}
|
|
437
834
|
}
|
|
438
835
|
}
|
|
439
836
|
|
|
440
|
-
|
|
441
|
-
|
|
442
837
|
/**
|
|
443
838
|
* ::: setUidConvSelected :::
|
|
444
839
|
*/
|
|
445
|
-
setUidConvSelected(uidConvSelected: string, conversationType?: string
|
|
840
|
+
setUidConvSelected(uidConvSelected: string, conversationType?: string) {
|
|
446
841
|
this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
|
|
447
|
-
this.uidConvSelected = uidConvSelected
|
|
842
|
+
this.uidConvSelected = uidConvSelected
|
|
843
|
+
this.logger.log('uidConvSelected', uidConvSelected)
|
|
448
844
|
// this.conversationsHandlerService.uidConvSelected = uidConvSelected;
|
|
449
845
|
if (uidConvSelected) {
|
|
450
|
-
let conversationSelected
|
|
846
|
+
let conversationSelected
|
|
451
847
|
if (conversationType === 'active') {
|
|
452
|
-
conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected)
|
|
453
|
-
} else if (conversationType === 'archived') {
|
|
454
|
-
conversationSelected = this.archivedConversations.find(item => item.uid === this.uidConvSelected);
|
|
455
|
-
}
|
|
848
|
+
conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
|
|
849
|
+
} else if (conversationType === 'archived') { conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected) }
|
|
456
850
|
if (conversationSelected) {
|
|
457
|
-
this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected)
|
|
458
|
-
this.logger.log('[CONVS-LIST-PAGE]
|
|
459
|
-
this.conversationSelected = conversationSelected
|
|
460
|
-
this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
|
|
851
|
+
this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected,)
|
|
852
|
+
this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded')
|
|
853
|
+
this.conversationSelected = conversationSelected
|
|
854
|
+
this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
|
|
461
855
|
}
|
|
462
856
|
}
|
|
463
857
|
}
|
|
464
858
|
|
|
465
859
|
onConversationSelected(conversation: ConversationModel) {
|
|
466
|
-
|
|
860
|
+
this.logger.log('onConversationSelected conversation', conversation)
|
|
467
861
|
if (conversation.archived) {
|
|
468
862
|
this.navigateByUrl('archived', conversation.uid)
|
|
469
|
-
this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid
|
|
863
|
+
this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid,
|
|
864
|
+
)
|
|
470
865
|
} else {
|
|
471
866
|
this.navigateByUrl('active', conversation.uid)
|
|
472
867
|
this.logger.log('[CONVS-LIST-PAGE] onConversationSelected active conversation.uid ', conversation.uid)
|
|
473
868
|
}
|
|
474
|
-
|
|
475
869
|
}
|
|
476
870
|
|
|
477
871
|
onImageLoaded(conversation: any) {
|
|
478
872
|
// this.logger.log('[CONVS-LIST-PAGE] onImageLoaded', conversation)
|
|
479
|
-
let conversation_with_fullname = conversation.sender_fullname
|
|
480
|
-
let conversation_with = conversation.sender
|
|
873
|
+
let conversation_with_fullname = conversation.sender_fullname
|
|
874
|
+
let conversation_with = conversation.sender
|
|
481
875
|
if (conversation.sender === this.loggedUserUid) {
|
|
482
|
-
conversation_with = conversation.recipient
|
|
483
|
-
conversation_with_fullname = conversation.recipient_fullname
|
|
876
|
+
conversation_with = conversation.recipient
|
|
877
|
+
conversation_with_fullname = conversation.recipient_fullname
|
|
484
878
|
} else if (isGroup(conversation)) {
|
|
485
879
|
// conversation_with_fullname = conv.sender_fullname;
|
|
486
880
|
// conv.last_message_text = conv.last_message_text;
|
|
487
|
-
conversation_with = conversation.recipient
|
|
488
|
-
conversation_with_fullname = conversation.recipient_fullname
|
|
881
|
+
conversation_with = conversation.recipient
|
|
882
|
+
conversation_with_fullname = conversation.recipient_fullname
|
|
489
883
|
}
|
|
490
|
-
if (!conversation_with.startsWith(
|
|
491
|
-
conversation.image = this.imageRepoService.getImagePhotoUrl(
|
|
884
|
+
if (!conversation_with.startsWith('support-group')) {
|
|
885
|
+
conversation.image = this.imageRepoService.getImagePhotoUrl(
|
|
886
|
+
conversation_with,
|
|
887
|
+
)
|
|
492
888
|
}
|
|
493
889
|
}
|
|
494
890
|
|
|
495
891
|
onConversationLoaded(conversation: ConversationModel) {
|
|
496
|
-
this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
|
|
497
|
-
this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
|
|
892
|
+
// this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
|
|
893
|
+
// this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
|
|
498
894
|
// if (conversation.is_new === false) {
|
|
499
895
|
// this.ionContentConvList.scrollToTop(0);
|
|
500
896
|
// }
|
|
501
897
|
|
|
502
|
-
const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT']
|
|
503
|
-
const translationMap = this.translateService.translateLanguage(keys)
|
|
898
|
+
const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT']
|
|
899
|
+
const translationMap = this.translateService.translateLanguage(keys)
|
|
504
900
|
// Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
|
|
505
901
|
|
|
506
|
-
var regex = /<br\s*[\/]?>/gi
|
|
902
|
+
var regex = /<br\s*[\/]?>/gi
|
|
507
903
|
if (conversation && conversation.last_message_text) {
|
|
508
|
-
conversation.last_message_text = conversation.last_message_text.replace(regex,
|
|
904
|
+
conversation.last_message_text = conversation.last_message_text.replace(regex, '',)
|
|
509
905
|
|
|
510
906
|
//FIX-BUG: 'YOU: YOU: YOU: text' on last-message-text in conversation-list
|
|
511
907
|
if (conversation.sender === this.loggedUserUid && !conversation.last_message_text.includes(': ')) {
|
|
512
908
|
// this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded', conversation)
|
|
513
909
|
|
|
514
|
-
if (conversation.type !==
|
|
515
|
-
conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text
|
|
516
|
-
|
|
517
|
-
} else if (conversation.type === "image") {
|
|
518
|
-
|
|
910
|
+
if (conversation.type !== 'image' && conversation.type !== 'file') {
|
|
911
|
+
conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text
|
|
912
|
+
} else if (conversation.type === 'image') {
|
|
519
913
|
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
|
|
520
914
|
// this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
|
|
521
|
-
const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
|
|
915
|
+
const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
|
|
522
916
|
|
|
523
|
-
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE
|
|
524
|
-
|
|
525
|
-
} else if (conversation.type === "file") {
|
|
917
|
+
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE
|
|
918
|
+
} else if (conversation.type === 'file') {
|
|
526
919
|
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
|
|
527
|
-
const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
|
|
528
|
-
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT
|
|
920
|
+
const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
|
|
921
|
+
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT
|
|
529
922
|
}
|
|
530
923
|
} else {
|
|
531
|
-
if (conversation.type ===
|
|
532
|
-
|
|
924
|
+
if (conversation.type === 'image') {
|
|
533
925
|
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
|
|
534
926
|
// this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
|
|
535
|
-
const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
|
|
927
|
+
const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
|
|
536
928
|
|
|
537
|
-
conversation.last_message_text = SENT_AN_IMAGE
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
else if (conversation.type === "file") {
|
|
929
|
+
conversation.last_message_text = SENT_AN_IMAGE
|
|
930
|
+
} else if (conversation.type === 'file') {
|
|
541
931
|
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
|
|
542
|
-
const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
|
|
543
|
-
conversation.last_message_text = SENT_AN_ATTACHMENT
|
|
544
|
-
|
|
932
|
+
const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
|
|
933
|
+
conversation.last_message_text = SENT_AN_ATTACHMENT
|
|
545
934
|
}
|
|
546
935
|
}
|
|
547
936
|
}
|
|
@@ -551,56 +940,65 @@ export class ConversationListPage implements OnInit {
|
|
|
551
940
|
// this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 1')
|
|
552
941
|
// var regex = /^(^|[\n\r])\s*1\.\s.*\s+1\.\s$/
|
|
553
942
|
// let matchRegex = false
|
|
554
|
-
// if (regex.test(last_message_text)) {
|
|
943
|
+
// if (regex.test(last_message_text)) {
|
|
555
944
|
// this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 2')
|
|
556
945
|
// matchRegex = true
|
|
557
946
|
// return matchRegex
|
|
558
947
|
// }
|
|
559
948
|
// }
|
|
560
949
|
|
|
561
|
-
|
|
562
950
|
navigateByUrl(converationType: string, uidConvSelected: string) {
|
|
563
|
-
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
|
|
564
|
-
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
|
|
565
|
-
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
|
|
566
|
-
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected ', this.conversationSelected)
|
|
567
951
|
|
|
568
|
-
this.
|
|
952
|
+
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected)
|
|
953
|
+
|
|
954
|
+
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected)
|
|
955
|
+
|
|
956
|
+
this.setUidConvSelected(uidConvSelected, converationType)
|
|
569
957
|
if (checkPlatformIsMobile()) {
|
|
570
|
-
this.logger.log('[CONVS-LIST-PAGE]
|
|
571
|
-
|
|
958
|
+
this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
|
|
959
|
+
this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window < 768)', this.navService)
|
|
960
|
+
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
|
|
961
|
+
let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
|
|
572
962
|
this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
|
|
573
|
-
|
|
963
|
+
// replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
|
|
964
|
+
this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
|
|
574
965
|
} else {
|
|
575
|
-
this.logger.log('[CONVS-LIST-PAGE]
|
|
576
|
-
|
|
966
|
+
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
|
|
967
|
+
this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
|
|
968
|
+
this.logger.log('[CONVS-LIST-PAGE] MOBILE (window >= 768) ', this.navService)
|
|
969
|
+
let pageUrl = 'conversation-detail/' + this.uidConvSelected
|
|
577
970
|
if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
|
|
578
|
-
pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
|
|
971
|
+
pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
|
|
579
972
|
}
|
|
580
|
-
this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl)
|
|
581
|
-
|
|
973
|
+
this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl)
|
|
974
|
+
// replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
|
|
975
|
+
this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
|
|
582
976
|
}
|
|
583
977
|
}
|
|
584
978
|
|
|
585
|
-
|
|
586
979
|
// ---------------------------------------------------------
|
|
587
980
|
// Opens the list of contacts for direct convs
|
|
588
981
|
// ---------------------------------------------------------
|
|
589
982
|
openContactsDirectory(event: any) {
|
|
590
|
-
const TOKEN = this.tiledeskAuthService.getTiledeskToken()
|
|
591
|
-
this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN)
|
|
983
|
+
const TOKEN = this.tiledeskAuthService.getTiledeskToken()
|
|
984
|
+
this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN)
|
|
592
985
|
if (checkPlatformIsMobile()) {
|
|
593
|
-
presentModal(this.modalController, ContactsDirectoryPage, {
|
|
986
|
+
presentModal(this.modalController, ContactsDirectoryPage, {
|
|
987
|
+
token: TOKEN,
|
|
988
|
+
})
|
|
594
989
|
} else {
|
|
595
|
-
this.navService.push(ContactsDirectoryPage, { token: TOKEN })
|
|
990
|
+
this.navService.push(ContactsDirectoryPage, { token: TOKEN })
|
|
596
991
|
}
|
|
597
992
|
}
|
|
598
993
|
|
|
599
994
|
closeContactsDirectory() {
|
|
600
995
|
try {
|
|
601
|
-
closeModal(this.modalController)
|
|
996
|
+
closeModal(this.modalController)
|
|
602
997
|
} catch (err) {
|
|
603
|
-
this.logger.error(
|
|
998
|
+
this.logger.error(
|
|
999
|
+
'[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
|
|
1000
|
+
err,
|
|
1001
|
+
)
|
|
604
1002
|
}
|
|
605
1003
|
}
|
|
606
1004
|
|
|
@@ -608,8 +1006,8 @@ export class ConversationListPage implements OnInit {
|
|
|
608
1006
|
// Opens logged user profile modal
|
|
609
1007
|
// ---------------------------------------------------------
|
|
610
1008
|
openProfileInfo(event: any) {
|
|
611
|
-
const TOKEN = this.messagingAuthService.getToken()
|
|
612
|
-
this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN)
|
|
1009
|
+
const TOKEN = this.messagingAuthService.getToken()
|
|
1010
|
+
this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN)
|
|
613
1011
|
if (checkPlatformIsMobile()) {
|
|
614
1012
|
presentModal(this.modalController, ProfileInfoPage, { token: TOKEN })
|
|
615
1013
|
} else {
|
|
@@ -617,102 +1015,186 @@ export class ConversationListPage implements OnInit {
|
|
|
617
1015
|
}
|
|
618
1016
|
}
|
|
619
1017
|
|
|
1018
|
+
listenToCloseConvFromHeaderConversation() {
|
|
1019
|
+
this.events.subscribe('conversation:closed', (convId) => {
|
|
1020
|
+
this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation convId', convId)
|
|
620
1021
|
|
|
1022
|
+
const conversation = this.conversations.find(
|
|
1023
|
+
(conv) => conv.uid === convId,
|
|
1024
|
+
)
|
|
1025
|
+
this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation conversation', conversation)
|
|
1026
|
+
this.onCloseConversation(conversation)
|
|
1027
|
+
})
|
|
1028
|
+
}
|
|
621
1029
|
|
|
622
1030
|
// ----------------------------------------------------------------------------------------------
|
|
623
1031
|
// onCloseConversation
|
|
624
1032
|
// https://github.com/chat21/chat21-cloud-functions/blob/master/docs/api.md#delete-a-conversation
|
|
625
1033
|
// ----------------------------------------------------------------------------------------------
|
|
626
1034
|
onCloseConversation(conversation: ConversationModel) {
|
|
1035
|
+
this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversation', conversation)
|
|
1036
|
+
|
|
627
1037
|
// -------------------------------------------------------------------------------------
|
|
628
|
-
// Fix the display of the message "No conversation yet" when a conversation is archived
|
|
629
|
-
// but there are others in the list (happens when loadingIsActive is set to false because
|
|
1038
|
+
// Fix the display of the message "No conversation yet" when a conversation is archived
|
|
1039
|
+
// but there are others in the list (happens when loadingIsActive is set to false because
|
|
630
1040
|
// when is called the initConversationsHandler method there is not conversations)
|
|
631
1041
|
// -------------------------------------------------------------------------------------
|
|
632
|
-
this.loadingIsActive = false
|
|
1042
|
+
this.loadingIsActive = false
|
|
633
1043
|
// console.log('CONVS - CONV-LIST-PAGE onCloseConversation CONVS: ', conversation)
|
|
634
1044
|
this.logger.log('[CONVS-LIST-PAGE] onCloseConversation loadingIsActive: ', this.loadingIsActive)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement length', lastArrayElement.length);
|
|
652
|
-
if (lastArrayElement.length !== 32) {
|
|
653
|
-
conversationWith_segments.pop();
|
|
1045
|
+
if (conversation) {
|
|
1046
|
+
const conversationId = conversation.uid
|
|
1047
|
+
|
|
1048
|
+
this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
|
|
1049
|
+
|
|
1050
|
+
const conversationWith_segments = conversationId.split('-')
|
|
1051
|
+
this.logger.log(
|
|
1052
|
+
'[CONVS-LIST-PAGE] - conversationId_segments: ',
|
|
1053
|
+
conversationWith_segments,
|
|
1054
|
+
)
|
|
1055
|
+
|
|
1056
|
+
// Removes the last element of the array if is = to the separator
|
|
1057
|
+
if (
|
|
1058
|
+
conversationWith_segments[conversationWith_segments.length - 1] === ''
|
|
1059
|
+
) {
|
|
1060
|
+
conversationWith_segments.pop()
|
|
654
1061
|
}
|
|
655
|
-
}
|
|
656
1062
|
|
|
657
|
-
if (conversationId.startsWith("support-group")) {
|
|
658
|
-
let project_id = ''
|
|
659
1063
|
if (conversationWith_segments.length === 4) {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1064
|
+
const lastArrayElement =
|
|
1065
|
+
conversationWith_segments[conversationWith_segments.length - 1]
|
|
1066
|
+
this.logger.log(
|
|
1067
|
+
'[CONVS-LIST-PAGE] - lastArrayElement ',
|
|
1068
|
+
lastArrayElement,
|
|
1069
|
+
)
|
|
1070
|
+
this.logger.log(
|
|
1071
|
+
'[CONVS-LIST-PAGE] - lastArrayElement length',
|
|
1072
|
+
lastArrayElement.length,
|
|
1073
|
+
)
|
|
1074
|
+
if (lastArrayElement.length !== 32) {
|
|
1075
|
+
conversationWith_segments.pop()
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
664
1078
|
|
|
1079
|
+
if (conversationId.startsWith('support-group')) {
|
|
1080
|
+
let project_id = ''
|
|
1081
|
+
if (conversationWith_segments.length === 4) {
|
|
1082
|
+
project_id = conversationWith_segments[2]
|
|
1083
|
+
|
|
1084
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1085
|
+
this.archiveSupportGroupConv(
|
|
1086
|
+
tiledeskToken,
|
|
1087
|
+
project_id,
|
|
1088
|
+
conversationId,
|
|
1089
|
+
)
|
|
1090
|
+
} else {
|
|
1091
|
+
this.getProjectIdByConversationWith(conversationId)
|
|
1092
|
+
}
|
|
665
1093
|
} else {
|
|
666
|
-
this.
|
|
1094
|
+
this.conversationsHandlerService.archiveConversation(conversationId)
|
|
667
1095
|
}
|
|
668
|
-
} else {
|
|
669
|
-
this.conversationsHandlerService.archiveConversation(conversationId)
|
|
670
1096
|
}
|
|
671
1097
|
}
|
|
672
1098
|
|
|
673
1099
|
getProjectIdByConversationWith(conversationId: string) {
|
|
674
|
-
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
675
|
-
|
|
676
|
-
this.tiledeskService
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1100
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1101
|
+
|
|
1102
|
+
this.tiledeskService
|
|
1103
|
+
.getProjectIdByConvRecipient(tiledeskToken, conversationId)
|
|
1104
|
+
.subscribe(
|
|
1105
|
+
(res) => {
|
|
1106
|
+
this.logger.log(
|
|
1107
|
+
'[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT RES',
|
|
1108
|
+
res,
|
|
1109
|
+
)
|
|
1110
|
+
|
|
1111
|
+
if (res) {
|
|
1112
|
+
const project_id = res.id_project
|
|
1113
|
+
this.logger.log(
|
|
1114
|
+
'[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id',
|
|
1115
|
+
project_id,
|
|
1116
|
+
)
|
|
1117
|
+
this.archiveSupportGroupConv(
|
|
1118
|
+
tiledeskToken,
|
|
1119
|
+
project_id,
|
|
1120
|
+
conversationId,
|
|
1121
|
+
)
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
(error) => {
|
|
1125
|
+
this.logger.error(
|
|
1126
|
+
'[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT - ERROR ',
|
|
1127
|
+
error,
|
|
1128
|
+
)
|
|
1129
|
+
},
|
|
1130
|
+
() => {
|
|
1131
|
+
this.logger.log(
|
|
1132
|
+
'[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',
|
|
1133
|
+
)
|
|
1134
|
+
},
|
|
1135
|
+
)
|
|
692
1136
|
}
|
|
693
1137
|
|
|
694
1138
|
archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
|
|
695
|
-
this.logger.log(
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
1139
|
+
this.logger.log(
|
|
1140
|
+
'[CONVS-LIST-PAGE] - onCloseConversation projectId: ',
|
|
1141
|
+
project_id,
|
|
1142
|
+
)
|
|
1143
|
+
this.tiledeskService
|
|
1144
|
+
.closeSupportGroup(tiledeskToken, project_id, conversationId)
|
|
1145
|
+
.subscribe(
|
|
1146
|
+
(res) => {
|
|
1147
|
+
this.archiveActionNotAllowed = false
|
|
1148
|
+
this.logger.log(
|
|
1149
|
+
'[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES',
|
|
1150
|
+
res,
|
|
1151
|
+
)
|
|
1152
|
+
},
|
|
1153
|
+
(error) => {
|
|
1154
|
+
this.logger.error(
|
|
1155
|
+
'[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ',
|
|
1156
|
+
error,
|
|
1157
|
+
)
|
|
1158
|
+
this.logger.error(
|
|
1159
|
+
'[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.error.msg ',
|
|
1160
|
+
error.error.msg,
|
|
1161
|
+
)
|
|
1162
|
+
this.logger.error(
|
|
1163
|
+
'[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.status ',
|
|
1164
|
+
error.status,
|
|
1165
|
+
)
|
|
1166
|
+
if (error.error.msg === 'you dont belong to the project.') {
|
|
1167
|
+
this.archiveActionNotAllowed = true
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
() => {
|
|
1171
|
+
this.logger.log(
|
|
1172
|
+
'[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *',
|
|
1173
|
+
)
|
|
1174
|
+
this.logger.log(
|
|
1175
|
+
'[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ',
|
|
1176
|
+
this.conversations,
|
|
1177
|
+
)
|
|
1178
|
+
this.logger.log(
|
|
1179
|
+
'[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ',
|
|
1180
|
+
this.conversations.length,
|
|
1181
|
+
)
|
|
1182
|
+
this.events.publish('conversationhasbeenclosed', conversationId)
|
|
1183
|
+
},
|
|
1184
|
+
)
|
|
707
1185
|
}
|
|
708
1186
|
|
|
1187
|
+
onCloseAlert($event) {
|
|
1188
|
+
this.logger.log('[CONVS-LIST-PAGE] - onCloseAlert ', $event)
|
|
1189
|
+
this.archiveActionNotAllowed = false
|
|
1190
|
+
}
|
|
709
1191
|
|
|
710
1192
|
public generateFake(count: number): Array<number> {
|
|
711
|
-
const indexes = []
|
|
1193
|
+
const indexes = []
|
|
712
1194
|
for (let i = 0; i < count; i++) {
|
|
713
|
-
indexes.push(i)
|
|
1195
|
+
indexes.push(i)
|
|
714
1196
|
}
|
|
715
|
-
return indexes
|
|
1197
|
+
return indexes
|
|
716
1198
|
}
|
|
717
1199
|
|
|
718
1200
|
// ------------------------------------------------------------------
|
|
@@ -728,7 +1210,6 @@ export class ConversationListPage implements OnInit {
|
|
|
728
1210
|
// this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
|
|
729
1211
|
// }
|
|
730
1212
|
|
|
731
|
-
|
|
732
1213
|
// // info page
|
|
733
1214
|
// returnCloseInfoPage() {
|
|
734
1215
|
// this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
|
|
@@ -737,7 +1218,6 @@ export class ConversationListPage implements OnInit {
|
|
|
737
1218
|
|
|
738
1219
|
// }
|
|
739
1220
|
|
|
740
|
-
|
|
741
1221
|
// private navigatePage() {
|
|
742
1222
|
// this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
|
|
743
1223
|
// let urlPage = 'detail/';
|
|
@@ -758,7 +1238,6 @@ export class ConversationListPage implements OnInit {
|
|
|
758
1238
|
// this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
|
|
759
1239
|
// }
|
|
760
1240
|
|
|
761
|
-
|
|
762
1241
|
// openDetailsWithState(conversationSelected) {
|
|
763
1242
|
// console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
|
|
764
1243
|
// let navigationExtras: NavigationExtras = {
|
|
@@ -787,8 +1266,6 @@ export class ConversationListPage implements OnInit {
|
|
|
787
1266
|
// this.initialize();
|
|
788
1267
|
// }
|
|
789
1268
|
|
|
790
|
-
|
|
791
|
-
|
|
792
1269
|
/**
|
|
793
1270
|
* ::: conversationsChanged :::
|
|
794
1271
|
* evento richiamato su add, change, remove dell'elenco delle conversazioni
|
|
@@ -796,15 +1273,13 @@ export class ConversationListPage implements OnInit {
|
|
|
796
1273
|
* 2 - aggiorno il conto delle nuove conversazioni
|
|
797
1274
|
* 4 - se esiste un uidReciverFromUrl (passato nell'url)
|
|
798
1275
|
* e se esiste una conversazione con lo stesso id di uidReciverFromUrl
|
|
799
|
-
* imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
1276
|
+
* imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
800
1277
|
* e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
|
|
801
1278
|
* 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
|
|
802
|
-
* e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
|
|
1279
|
+
* e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
|
|
803
1280
|
* (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
804
1281
|
*/
|
|
805
1282
|
|
|
806
|
-
|
|
807
|
-
|
|
808
1283
|
// ------------------------------------------------------------------------------------
|
|
809
1284
|
// ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
|
|
810
1285
|
// when all chat messages are displayed,
|