@chat21/chat21-ionic 3.0.58 → 3.0.59-rc15

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 (96) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +9 -0
  3. package/config.xml +11 -2
  4. package/env.sample +2 -0
  5. package/package.json +1 -1
  6. package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
  7. package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
  8. package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
  9. package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
  10. package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
  11. package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  12. package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
  13. package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
  14. package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
  15. package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
  16. package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
  17. package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  18. package/resources/Android/splash.png +0 -0
  19. package/src/app/app-routing.module.ts +21 -17
  20. package/src/app/app.component.html +6 -3
  21. package/src/app/app.component.ts +259 -55
  22. package/src/app/app.module.ts +16 -8
  23. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  24. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +4 -4
  25. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +8 -2
  26. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +6 -1
  27. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +7 -2
  28. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +47 -2
  29. package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
  30. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
  31. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +39 -9
  32. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
  33. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  34. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  35. package/src/app/components/authentication/login/login.component.html +10 -10
  36. package/src/app/components/authentication/login/login.component.ts +2 -1
  37. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  38. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +1 -1
  39. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +17 -12
  40. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +12 -0
  41. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +21 -5
  42. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +3 -2
  43. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +22 -17
  44. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -5
  45. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  46. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  47. package/src/app/components/image-viewer/image-viewer.component.html +23 -0
  48. package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
  49. package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
  50. package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
  51. package/src/app/components/project-item/project-item.component.html +147 -0
  52. package/src/app/components/project-item/project-item.component.scss +669 -0
  53. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  54. package/src/app/components/project-item/project-item.component.ts +317 -0
  55. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +7 -0
  56. package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +22 -5
  57. package/src/app/pages/authentication/login/login.page.html +1 -2
  58. package/src/app/pages/authentication/login/login.page.ts +1 -1
  59. package/src/app/pages/conversation-detail/conversation-detail.page.html +5 -3
  60. package/src/app/pages/conversation-detail/conversation-detail.page.ts +122 -30
  61. package/src/app/pages/conversations-list/conversations-list.page.html +44 -23
  62. package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
  63. package/src/app/pages/conversations-list/conversations-list.page.ts +172 -12
  64. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  65. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  66. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  67. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  68. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  69. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +108 -0
  70. package/src/app/services/nav-proxy.service.ts +1 -1
  71. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  72. package/src/app/services/websocket/websocket-js.ts +557 -0
  73. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  74. package/src/app/services/websocket/websocket.service.ts +274 -0
  75. package/src/app/shared/shared.module.ts +7 -1
  76. package/src/assets/i18n/en.json +9 -1
  77. package/src/assets/i18n/it.json +9 -1
  78. package/src/assets/js/chat21client.js +141 -67
  79. package/src/assets/transparent.png +0 -0
  80. package/src/chat-config-pre-test.json +3 -1
  81. package/src/chat-config-template.json +3 -1
  82. package/src/chat-config.json +3 -1
  83. package/src/chat21-core/providers/chat-manager.ts +3 -3
  84. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
  85. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +6 -6
  86. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
  87. package/src/chat21-core/providers/firebase/firebase-notifications.ts +1 -1
  88. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
  89. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
  90. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  91. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +27 -27
  92. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  93. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  94. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
  95. package/src/chat21-core/utils/utils.ts +1 -1
  96. package/src/firebase-messaging-sw-template.js +1 -1
@@ -1,139 +1,302 @@
1
1
  ion-header {
2
- border-bottom-style: solid;
3
- border-color: var(--light-gray);
4
- border-bottom-width: thin;
2
+ border-bottom-style: solid;
3
+ border-color: var(--light-gray);
4
+ border-bottom-width: thin;
5
5
  }
6
6
 
7
-
8
-
9
7
  ion-list {
10
- display: block;
11
- margin-block-start: 1em;
12
- margin-block-end: 1em;
13
- margin-inline-start: 0px;
14
- margin-inline-end: 0px;
15
- padding-inline-start: 40px;
16
- list-style-type: none;
17
- margin: 0;
18
- padding: 0;
8
+ display: block;
9
+ margin-block-start: 1em;
10
+ margin-block-end: 1em;
11
+ margin-inline-start: 0px;
12
+ margin-inline-end: 0px;
13
+ padding-inline-start: 40px;
14
+ list-style-type: none;
15
+ margin: 0;
16
+ padding: 0;
19
17
 
20
- ion-item {
21
- cursor: pointer;
22
- height: 64px;
18
+ ion-item {
19
+ cursor: pointer;
20
+ height: 64px;
21
+ position: relative;
22
+ display: flex;
23
+ text-decoration: none;
24
+ padding-left: 8px;
25
+ padding-right: 8px;
26
+ --padding-start: 0;
27
+ --inner-padding-end: 0;
28
+ .selected {
29
+ border-radius: 10px;
30
+ padding-left: 8px;
31
+ padding-right: 8px;
32
+ position: absolute;
33
+ width: 100%;
34
+ height: 100%;
35
+ z-index: -1;
36
+ background-color: rgba(0, 0, 0, 0.05);
37
+ }
38
+ ion-avatar {
39
+ position: relative;
40
+ padding: 0;
41
+ margin: 0 12px 0 8px;
42
+ height: 50px;
43
+ width: 50px;
44
+ min-width: 50px;
45
+ min-height: 50px;
46
+ line-height: 50px;
47
+ .avatar-placeholder {
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ border-radius: 50%;
54
+ text-align: center;
55
+ font-size: 20px;
56
+ color: #ffffff;
57
+ font-weight: 500;
58
+ }
59
+ .avatar-profile {
23
60
  position: relative;
24
- display: flex;
25
- text-decoration: none;
26
- padding-left: 8px;
27
- padding-right: 8px;
28
- --padding-start: 0;
29
- --inner-padding-end: 0;
30
- .selected {
31
- border-radius: 10px;
32
- padding-left: 8px;
33
- padding-right: 8px;
34
- position: absolute;
35
- width: 100%;
36
- height: 100%;
37
- z-index:-1;
38
- background-color: rgba(0, 0, 0, .05);
39
- }
40
- ion-avatar {
41
- position: relative;
42
- padding:0;
43
- margin:0 12px 0 8px;
44
- height: 50px;
45
- width: 50px;
46
- min-width: 50px;
47
- min-height: 50px;
48
- line-height: 50px;
49
- .avatar-placeholder {
50
- position: absolute;
51
- top:0;
52
- left:0;
53
- width: 100%;
54
- height: 100%;
55
- border-radius: 50%;
56
- text-align: center;
57
- font-size: 20px;
58
- color:#ffffff;
59
- font-weight: 500;
60
- }
61
- .avatar-profile {
62
- position: relative;
63
- display: inline-block;
64
- width: 100%;
65
- height: 100%;
66
- background-color: transparent;
67
- background-size: cover;
68
- background-position: top center;
69
- border-radius: 50%;
70
- border-color: #c3c3c3;
71
- border-style: solid;
72
- border-width: 0px;
73
- }
74
- }
75
- ion-label {
76
- flex: 1 1 0px;
77
- justify-content: center;
78
- min-width: 0;
79
- padding: 0;
80
- font-family: Helvetica, Helvetica, Arial, sans-serif;
81
- line-height: 1.28;
82
- text-rendering: optimizeLegibility;
83
- .conversation_with {
84
- color: rgba(0, 0, 0, 1);
85
- font-size: 15px;
86
- font-weight: 400;
87
- line-height: 1.4;
88
- }
89
- .conversation_message {
90
- p {
91
- color: rgba(153, 153, 153, 1);
92
- font-size: 13px;
93
- font-weight: 400;
94
- height: 18px;
95
- &.not-read {
96
- font-weight:bold;
97
- }
98
- }
99
-
100
- }
101
-
102
- }
103
- ion-note {
104
- position: absolute;
105
- right: 8px;
106
- top: 4px;
107
- font-size: 10px;
61
+ display: inline-block;
62
+ width: 100%;
63
+ height: 100%;
64
+ background-color: transparent;
65
+ background-size: cover;
66
+ background-position: top center;
67
+ border-radius: 50%;
68
+ border-color: #c3c3c3;
69
+ border-style: solid;
70
+ border-width: 0px;
71
+ }
72
+ }
73
+ ion-label {
74
+ flex: 1 1 0px;
75
+ justify-content: center;
76
+ min-width: 0;
77
+ padding: 0;
78
+ font-family: Helvetica, Helvetica, Arial, sans-serif;
79
+ line-height: 1.28;
80
+ text-rendering: optimizeLegibility;
81
+ .conversation_with {
82
+ color: rgba(0, 0, 0, 1);
83
+ font-size: 15px;
84
+ font-weight: 400;
85
+ line-height: 1.4;
86
+ }
87
+ .conversation_message {
88
+ p {
89
+ color: rgba(153, 153, 153, 1);
90
+ font-size: 13px;
91
+ font-weight: 400;
92
+ height: 18px;
93
+ &.not-read {
94
+ font-weight: bold;
95
+ }
108
96
  }
109
- ion-buttons {
110
- margin: 0;
111
- ion-button {
112
- padding: 0;
113
- margin: 0;
114
- height: 24px;
115
- width: 24px;
116
- font-size: 10px;
117
- --padding-start: 0px;
118
- --padding-end: 0px;
119
- color: rgba(153, 153, 153, 1);
120
- background-color: transparent;
121
- &:hover {
122
- background-color: rgba(0, 0, 0, .05)
123
- }
124
- }
97
+ }
98
+ }
99
+ ion-note {
100
+ position: absolute;
101
+ right: 8px;
102
+ top: 4px;
103
+ font-size: 10px;
104
+ }
105
+ ion-buttons {
106
+ margin: 0;
107
+ ion-button {
108
+ padding: 0;
109
+ margin: 0;
110
+ height: 24px;
111
+ width: 24px;
112
+ font-size: 10px;
113
+ --padding-start: 0px;
114
+ --padding-end: 0px;
115
+ color: rgba(153, 153, 153, 1);
116
+ background-color: transparent;
117
+ &:hover {
118
+ background-color: rgba(0, 0, 0, 0.05);
125
119
  }
120
+ }
121
+ }
126
122
 
127
- .notification_point {
128
- width: 10px;
129
- height: 10px;
130
- border-radius: 50%;
131
- background-color: #0b5c89;
132
- position: absolute;
133
- right: 6px;
134
- bottom: 8px;
135
- }
123
+ .notification_point {
124
+ width: 10px;
125
+ height: 10px;
126
+ border-radius: 50%;
127
+ background-color: #0b5c89;
128
+ position: absolute;
129
+ right: 6px;
130
+ bottom: 8px;
136
131
  }
132
+ }
133
+ }
134
+
135
+ .waiting-for-connection {
136
+ --background: #fdd764;
137
+ --min-height: 70px;
138
+ }
139
+
140
+ // -------------------------------
141
+ // Spinner
142
+ // -------------------------------
143
+ .sk-fading-circle {
144
+ // margin: 100px auto;
145
+ width: 25px;
146
+ height: 25px;
147
+ position: relative;
148
+ margin-left: 10px;
149
+ margin-top: 13px;
150
+ }
151
+
152
+ .sk-fading-circle .sk-circle {
153
+ width: 100%;
154
+ height: 100%;
155
+ position: absolute;
156
+ left: 0;
157
+ top: 0;
158
+ }
159
+
160
+ .sk-fading-circle .sk-circle:before {
161
+ content: "";
162
+ display: block;
163
+ margin: 0 auto;
164
+ width: 15%;
165
+ height: 15%;
166
+ background-color: #333;
167
+ border-radius: 100%;
168
+ -webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
169
+ animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
170
+ }
171
+ .sk-fading-circle .sk-circle2 {
172
+ -webkit-transform: rotate(30deg);
173
+ -ms-transform: rotate(30deg);
174
+ transform: rotate(30deg);
175
+ }
176
+ .sk-fading-circle .sk-circle3 {
177
+ -webkit-transform: rotate(60deg);
178
+ -ms-transform: rotate(60deg);
179
+ transform: rotate(60deg);
180
+ }
181
+ .sk-fading-circle .sk-circle4 {
182
+ -webkit-transform: rotate(90deg);
183
+ -ms-transform: rotate(90deg);
184
+ transform: rotate(90deg);
185
+ }
186
+ .sk-fading-circle .sk-circle5 {
187
+ -webkit-transform: rotate(120deg);
188
+ -ms-transform: rotate(120deg);
189
+ transform: rotate(120deg);
190
+ }
191
+ .sk-fading-circle .sk-circle6 {
192
+ -webkit-transform: rotate(150deg);
193
+ -ms-transform: rotate(150deg);
194
+ transform: rotate(150deg);
195
+ }
196
+ .sk-fading-circle .sk-circle7 {
197
+ -webkit-transform: rotate(180deg);
198
+ -ms-transform: rotate(180deg);
199
+ transform: rotate(180deg);
200
+ }
201
+ .sk-fading-circle .sk-circle8 {
202
+ -webkit-transform: rotate(210deg);
203
+ -ms-transform: rotate(210deg);
204
+ transform: rotate(210deg);
205
+ }
206
+ .sk-fading-circle .sk-circle9 {
207
+ -webkit-transform: rotate(240deg);
208
+ -ms-transform: rotate(240deg);
209
+ transform: rotate(240deg);
210
+ }
211
+ .sk-fading-circle .sk-circle10 {
212
+ -webkit-transform: rotate(270deg);
213
+ -ms-transform: rotate(270deg);
214
+ transform: rotate(270deg);
215
+ }
216
+ .sk-fading-circle .sk-circle11 {
217
+ -webkit-transform: rotate(300deg);
218
+ -ms-transform: rotate(300deg);
219
+ transform: rotate(300deg);
220
+ }
221
+ .sk-fading-circle .sk-circle12 {
222
+ -webkit-transform: rotate(330deg);
223
+ -ms-transform: rotate(330deg);
224
+ transform: rotate(330deg);
225
+ }
226
+ .sk-fading-circle .sk-circle2:before {
227
+ -webkit-animation-delay: -1.1s;
228
+ animation-delay: -1.1s;
229
+ }
230
+ .sk-fading-circle .sk-circle3:before {
231
+ -webkit-animation-delay: -1s;
232
+ animation-delay: -1s;
233
+ }
234
+ .sk-fading-circle .sk-circle4:before {
235
+ -webkit-animation-delay: -0.9s;
236
+ animation-delay: -0.9s;
237
+ }
238
+ .sk-fading-circle .sk-circle5:before {
239
+ -webkit-animation-delay: -0.8s;
240
+ animation-delay: -0.8s;
241
+ }
242
+ .sk-fading-circle .sk-circle6:before {
243
+ -webkit-animation-delay: -0.7s;
244
+ animation-delay: -0.7s;
245
+ }
246
+ .sk-fading-circle .sk-circle7:before {
247
+ -webkit-animation-delay: -0.6s;
248
+ animation-delay: -0.6s;
249
+ }
250
+ .sk-fading-circle .sk-circle8:before {
251
+ -webkit-animation-delay: -0.5s;
252
+ animation-delay: -0.5s;
253
+ }
254
+ .sk-fading-circle .sk-circle9:before {
255
+ -webkit-animation-delay: -0.4s;
256
+ animation-delay: -0.4s;
257
+ }
258
+ .sk-fading-circle .sk-circle10:before {
259
+ -webkit-animation-delay: -0.3s;
260
+ animation-delay: -0.3s;
261
+ }
262
+ .sk-fading-circle .sk-circle11:before {
263
+ -webkit-animation-delay: -0.2s;
264
+ animation-delay: -0.2s;
265
+ }
266
+ .sk-fading-circle .sk-circle12:before {
267
+ -webkit-animation-delay: -0.1s;
268
+ animation-delay: -0.1s;
269
+ }
270
+
271
+ @-webkit-keyframes sk-circleFadeDelay {
272
+ 0%,
273
+ 39%,
274
+ 100% {
275
+ opacity: 0;
276
+ }
277
+ 40% {
278
+ opacity: 1;
279
+ }
280
+ }
281
+
282
+ @keyframes sk-circleFadeDelay {
283
+ 0%,
284
+ 39%,
285
+ 100% {
286
+ opacity: 0;
287
+ }
288
+ 40% {
289
+ opacity: 1;
290
+ }
291
+ }
292
+
293
+ #no-convs-wpr {
294
+ margin: 100px auto;
295
+ }
137
296
 
138
-
297
+ .open-iframe-item {
298
+ padding-left: 0px !important ;
299
+ padding-right: 0px !important;
300
+ height: 55px !important;
301
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
139
302
  }
@@ -22,16 +22,21 @@ import { NavProxyService } from '../../services/nav-proxy.service';
22
22
  import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
23
23
  import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page';
24
24
  import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page';
25
+ import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page';
25
26
  import { ProfileInfoPage } from '../profile-info/profile-info.page';
26
27
  import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
27
28
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
28
29
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
29
30
  import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
30
31
  import { AppConfigProvider } from '../../services/app-config';
31
-
32
+ import { Subscription } from 'rxjs';
33
+ import { Platform } from '@ionic/angular';
32
34
  // Logger
33
35
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
34
36
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
+ import { NetworkService } from 'src/app/services/network-service/network.service';
38
+ import { Subject } from 'rxjs';
39
+ import { takeUntil } from 'rxjs/operators'
35
40
 
36
41
  @Component({
37
42
  selector: 'app-conversations-list',
@@ -39,7 +44,10 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
39
44
  styleUrls: ['./conversations-list.page.scss'],
40
45
  })
41
46
  export class ConversationListPage implements OnInit {
47
+
42
48
  @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
+
50
+ private unsubscribe$: Subject<any> = new Subject<any>();
43
51
  private subscriptions: Array<string>;
44
52
  public tenant: string;
45
53
  public loggedUserUid: string;
@@ -51,7 +59,7 @@ export class ConversationListPage implements OnInit {
51
59
  public showPlaceholder = true;
52
60
  public numberOpenConv = 0;
53
61
  public loadingIsActive = true;
54
- public supportMode = environment.supportMode;
62
+ public supportMode: boolean;
55
63
 
56
64
  public convertMessage = convertMessage;
57
65
  private isShowMenuPage = false;
@@ -61,6 +69,16 @@ export class ConversationListPage implements OnInit {
61
69
 
62
70
  public conversationType = 'active'
63
71
  headerTitle: string;
72
+ subscription: Subscription;
73
+
74
+ public UNASSIGNED_CONVS_URL: any;
75
+ public hasClickedOpenUnservedConvIframe: boolean = false;
76
+ public lastProjectId: string;
77
+ public isOnline: boolean = true;
78
+ public checkInternet: boolean;
79
+
80
+ public displayNewConvsItem: boolean = true
81
+
64
82
 
65
83
 
66
84
  constructor(
@@ -78,10 +96,15 @@ export class ConversationListPage implements OnInit {
78
96
  private translateService: CustomTranslateService,
79
97
  public tiledeskService: TiledeskService,
80
98
  public tiledeskAuthService: TiledeskAuthService,
81
- public appConfigProvider: AppConfigProvider
99
+ public appConfigProvider: AppConfigProvider,
100
+ public platform: Platform,
101
+ private networkService: NetworkService,
102
+
82
103
  ) {
83
104
  this.listenToAppCompConvsLengthOnInitConvs();
84
105
  this.listenToLogoutEvent();
106
+ this.listenGoOnline();
107
+ this.listenGoOffline();
85
108
  this.listenToSwPostMessage();
86
109
 
87
110
  }
@@ -91,16 +114,122 @@ export class ConversationListPage implements OnInit {
91
114
  // @ Lifehooks
92
115
  // -----------------------------------------------
93
116
  ngOnInit() {
117
+ this.watchToConnectionStatus();
118
+ this.getSupportMode();
119
+
120
+ const currentUrl = this.router.url;
121
+ this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
122
+ this.route.queryParams.subscribe(params => {
123
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
124
+ if (params && params.convselected) {
125
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params convselected:', params.convselected);
126
+
127
+ const conversationSelected = this.conversations.find(item => item.uid === params.convselected);
128
+ if (conversationSelected) {
129
+ this.conversationSelected = conversationSelected;
130
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
131
+ this.navigateByUrl('active', params.convselected)
132
+ }
133
+
134
+ } else {
135
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
136
+ }
137
+ if (params && params.contact_id && params.contact_fullname) {
138
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
139
+ this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
140
+ this.uidConvSelected = params.contact_id
141
+ } else {
142
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
143
+ }
144
+
145
+ if (params && params.conversation_detail) {
146
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
147
+ this.router.navigateByUrl('conversation-detail/');
148
+
149
+ } else {
150
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
151
+ }
94
152
 
153
+ });
154
+ }
155
+
156
+
157
+
158
+ getSupportMode() {
159
+ this.supportMode = this.appConfigProvider.getConfig().supportMode;
160
+ // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
161
+ }
162
+
163
+ watchToConnectionStatus() {
164
+ this.networkService.checkInternetFunc().subscribe(isOnline => {
165
+ this.checkInternet = isOnline
166
+ this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
167
+
168
+ // checking internet connection
169
+ if (this.checkInternet == true) {
170
+
171
+ this.isOnline = true;
172
+ } else {
173
+ this.isOnline = false;
174
+ }
175
+ });
95
176
  }
96
177
 
178
+
97
179
  ionViewWillEnter() {
180
+ this.logger.log('Called ionViewDidEnter')
98
181
  this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
99
182
  this.listnerStart();
183
+
184
+ // exit from app with hardware back button
185
+ this.subscription = this.platform.backButton.subscribe(() => {
186
+ navigator['app'].exitApp();
187
+ });
188
+ }
189
+
190
+ // unsubscribe backButton.subscribe method to not use from other page
191
+ ionViewWillLeave() {
192
+ this.logger.log('Called ionViewWillLeave')
193
+ this.subscription.unsubscribe();
100
194
  }
101
195
 
102
196
  ionViewDidEnter() { }
103
197
 
198
+ getLastProjectId(projectid: string) {
199
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
200
+ this.lastProjectId = projectid;
201
+ }
202
+
203
+ openUnsevedConversationIframe() {
204
+ this.hasClickedOpenUnservedConvIframe = true
205
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
206
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
207
+ this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
208
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
209
+ this.openUnassignedConversations(this.UNASSIGNED_CONVS_URL)
210
+ }
211
+
212
+ // ---------------------------------------------------------
213
+ // Opens the Unassigned Conversations iframe
214
+ // ---------------------------------------------------------
215
+ openUnassignedConversations(UNASSIGNED_CONVS_URL) {
216
+
217
+ if (checkPlatformIsMobile()) {
218
+ presentModal(this.modalController, UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
219
+ } else {
220
+ this.navService.push(UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
221
+ }
222
+ }
223
+
224
+ _closeContactsDirectory() {
225
+ try {
226
+ closeModal(this.modalController);
227
+ } catch (err) {
228
+ this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
229
+ }
230
+ }
231
+
232
+
104
233
  listenToSwPostMessage() {
105
234
  this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
106
235
  const that = this;
@@ -137,12 +266,20 @@ export class ConversationListPage implements OnInit {
137
266
 
138
267
  private listnerStart() {
139
268
  const that = this;
140
- this.chatManager.BSStart.subscribe((data: any) => {
141
- this.logger.log('[CONVS-LIST-PAGE] ***** BSStart Current user *****', data);
142
- if (data) {
143
- that.initialize();
144
- }
145
- });
269
+ this.chatManager.BSStart
270
+ .pipe(
271
+ takeUntil(that.unsubscribe$)
272
+ )
273
+ .subscribe((data: any) => {
274
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
275
+ if (data) {
276
+ that.initialize();
277
+ }
278
+ }, error => {
279
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
280
+ }, () => {
281
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
282
+ });
146
283
  }
147
284
 
148
285
 
@@ -178,7 +315,6 @@ export class ConversationListPage implements OnInit {
178
315
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
179
316
  this.loadingIsActive = false;
180
317
  }
181
-
182
318
  }
183
319
 
184
320
 
@@ -198,9 +334,33 @@ export class ConversationListPage implements OnInit {
198
334
  });
199
335
  }
200
336
 
337
+ listenGoOnline() {
338
+
339
+ this.events.subscribe('go:online', (goonline) => {
340
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
341
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
342
+ if (goonline === true) {
343
+ this.displayNewConvsItem = true
344
+ }
345
+ });
346
+ }
347
+
348
+ listenGoOffline() {
349
+
350
+ this.events.subscribe('go:offline', (offline) => {
351
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
352
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
353
+ if (offline === true) {
354
+ this.displayNewConvsItem = false
355
+ }
356
+ });
357
+ }
358
+
201
359
  listenToLogoutEvent() {
202
360
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
203
361
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
362
+
363
+
204
364
  this.conversations = []
205
365
  this.conversationsHandlerService.conversations = [];
206
366
  this.uidConvSelected = null;
@@ -493,8 +653,8 @@ export class ConversationListPage implements OnInit {
493
653
  }
494
654
 
495
655
  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)
656
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
657
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
498
658
  // if (conversation.is_new === false) {
499
659
  // this.ionContentConvList.scrollToTop(0);
500
660
  // }