@chat21/chat21-ionic 3.0.55-RC12 → 3.0.55-RC20
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 +31 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +137 -88
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +13 -6
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +10 -8
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +34 -2
- package/src/app/chatlib/conversation-detail/message/text/text.component.html +2 -2
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +36 -15
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +142 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +41 -17
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -0
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +2 -2
- package/src/app/components/conversation-info/info-group/info-group.component.ts +2 -2
- package/src/app/components/utils/user-presence/user-presence.component.ts +8 -6
- package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +42 -6
- package/src/app/pages/conversations-list/conversations-list.page.ts +43 -20
- package/src/app/pages/loader-preview/loader-preview.page.html +1 -1
- package/src/app/pages/loader-preview/loader-preview.page.ts +18 -5
- package/src/app/services/network-service/network.service.spec.ts +12 -0
- package/src/app/services/network-service/network.service.ts +46 -0
- package/src/chat-config-pre-test.json +1 -1
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +19 -14
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +30 -10
- package/src/index.html +2 -2
|
@@ -214,4 +214,145 @@ ion-item:hover {
|
|
|
214
214
|
|
|
215
215
|
.waiting-for-connection {
|
|
216
216
|
--background: #fdd764;
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// -------------------------------
|
|
220
|
+
// Spinner
|
|
221
|
+
// -------------------------------
|
|
222
|
+
.sk-fading-circle {
|
|
223
|
+
// margin: 100px auto;
|
|
224
|
+
width: 40px;
|
|
225
|
+
height: 40px;
|
|
226
|
+
position: relative;
|
|
227
|
+
margin-left: 5px;
|
|
228
|
+
margin-top: 5px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.sk-fading-circle .sk-circle {
|
|
232
|
+
width: 100%;
|
|
233
|
+
height: 100%;
|
|
234
|
+
position: absolute;
|
|
235
|
+
left: 0;
|
|
236
|
+
top: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.sk-fading-circle .sk-circle:before {
|
|
240
|
+
content: '';
|
|
241
|
+
display: block;
|
|
242
|
+
margin: 0 auto;
|
|
243
|
+
width: 15%;
|
|
244
|
+
height: 15%;
|
|
245
|
+
background-color: #333;
|
|
246
|
+
border-radius: 100%;
|
|
247
|
+
-webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
|
248
|
+
animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
|
249
|
+
}
|
|
250
|
+
.sk-fading-circle .sk-circle2 {
|
|
251
|
+
-webkit-transform: rotate(30deg);
|
|
252
|
+
-ms-transform: rotate(30deg);
|
|
253
|
+
transform: rotate(30deg);
|
|
254
|
+
}
|
|
255
|
+
.sk-fading-circle .sk-circle3 {
|
|
256
|
+
-webkit-transform: rotate(60deg);
|
|
257
|
+
-ms-transform: rotate(60deg);
|
|
258
|
+
transform: rotate(60deg);
|
|
259
|
+
}
|
|
260
|
+
.sk-fading-circle .sk-circle4 {
|
|
261
|
+
-webkit-transform: rotate(90deg);
|
|
262
|
+
-ms-transform: rotate(90deg);
|
|
263
|
+
transform: rotate(90deg);
|
|
264
|
+
}
|
|
265
|
+
.sk-fading-circle .sk-circle5 {
|
|
266
|
+
-webkit-transform: rotate(120deg);
|
|
267
|
+
-ms-transform: rotate(120deg);
|
|
268
|
+
transform: rotate(120deg);
|
|
269
|
+
}
|
|
270
|
+
.sk-fading-circle .sk-circle6 {
|
|
271
|
+
-webkit-transform: rotate(150deg);
|
|
272
|
+
-ms-transform: rotate(150deg);
|
|
273
|
+
transform: rotate(150deg);
|
|
274
|
+
}
|
|
275
|
+
.sk-fading-circle .sk-circle7 {
|
|
276
|
+
-webkit-transform: rotate(180deg);
|
|
277
|
+
-ms-transform: rotate(180deg);
|
|
278
|
+
transform: rotate(180deg);
|
|
279
|
+
}
|
|
280
|
+
.sk-fading-circle .sk-circle8 {
|
|
281
|
+
-webkit-transform: rotate(210deg);
|
|
282
|
+
-ms-transform: rotate(210deg);
|
|
283
|
+
transform: rotate(210deg);
|
|
284
|
+
}
|
|
285
|
+
.sk-fading-circle .sk-circle9 {
|
|
286
|
+
-webkit-transform: rotate(240deg);
|
|
287
|
+
-ms-transform: rotate(240deg);
|
|
288
|
+
transform: rotate(240deg);
|
|
289
|
+
}
|
|
290
|
+
.sk-fading-circle .sk-circle10 {
|
|
291
|
+
-webkit-transform: rotate(270deg);
|
|
292
|
+
-ms-transform: rotate(270deg);
|
|
293
|
+
transform: rotate(270deg);
|
|
294
|
+
}
|
|
295
|
+
.sk-fading-circle .sk-circle11 {
|
|
296
|
+
-webkit-transform: rotate(300deg);
|
|
297
|
+
-ms-transform: rotate(300deg);
|
|
298
|
+
transform: rotate(300deg);
|
|
299
|
+
}
|
|
300
|
+
.sk-fading-circle .sk-circle12 {
|
|
301
|
+
-webkit-transform: rotate(330deg);
|
|
302
|
+
-ms-transform: rotate(330deg);
|
|
303
|
+
transform: rotate(330deg);
|
|
304
|
+
}
|
|
305
|
+
.sk-fading-circle .sk-circle2:before {
|
|
306
|
+
-webkit-animation-delay: -1.1s;
|
|
307
|
+
animation-delay: -1.1s;
|
|
308
|
+
}
|
|
309
|
+
.sk-fading-circle .sk-circle3:before {
|
|
310
|
+
-webkit-animation-delay: -1s;
|
|
311
|
+
animation-delay: -1s;
|
|
312
|
+
}
|
|
313
|
+
.sk-fading-circle .sk-circle4:before {
|
|
314
|
+
-webkit-animation-delay: -0.9s;
|
|
315
|
+
animation-delay: -0.9s;
|
|
316
|
+
}
|
|
317
|
+
.sk-fading-circle .sk-circle5:before {
|
|
318
|
+
-webkit-animation-delay: -0.8s;
|
|
319
|
+
animation-delay: -0.8s;
|
|
320
|
+
}
|
|
321
|
+
.sk-fading-circle .sk-circle6:before {
|
|
322
|
+
-webkit-animation-delay: -0.7s;
|
|
323
|
+
animation-delay: -0.7s;
|
|
324
|
+
}
|
|
325
|
+
.sk-fading-circle .sk-circle7:before {
|
|
326
|
+
-webkit-animation-delay: -0.6s;
|
|
327
|
+
animation-delay: -0.6s;
|
|
328
|
+
}
|
|
329
|
+
.sk-fading-circle .sk-circle8:before {
|
|
330
|
+
-webkit-animation-delay: -0.5s;
|
|
331
|
+
animation-delay: -0.5s;
|
|
332
|
+
}
|
|
333
|
+
.sk-fading-circle .sk-circle9:before {
|
|
334
|
+
-webkit-animation-delay: -0.4s;
|
|
335
|
+
animation-delay: -0.4s;
|
|
336
|
+
}
|
|
337
|
+
.sk-fading-circle .sk-circle10:before {
|
|
338
|
+
-webkit-animation-delay: -0.3s;
|
|
339
|
+
animation-delay: -0.3s;
|
|
340
|
+
}
|
|
341
|
+
.sk-fading-circle .sk-circle11:before {
|
|
342
|
+
-webkit-animation-delay: -0.2s;
|
|
343
|
+
animation-delay: -0.2s;
|
|
344
|
+
}
|
|
345
|
+
.sk-fading-circle .sk-circle12:before {
|
|
346
|
+
-webkit-animation-delay: -0.1s;
|
|
347
|
+
animation-delay: -0.1s;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@-webkit-keyframes sk-circleFadeDelay {
|
|
351
|
+
0%, 39%, 100% { opacity: 0; }
|
|
352
|
+
40% { opacity: 1; }
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@keyframes sk-circleFadeDelay {
|
|
356
|
+
0%, 39%, 100% { opacity: 0; }
|
|
357
|
+
40% { opacity: 1; }
|
|
358
|
+
}
|
|
@@ -8,9 +8,9 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
|
|
|
8
8
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
9
9
|
import { TranslateService } from '@ngx-translate/core';
|
|
10
10
|
import * as moment from 'moment';
|
|
11
|
-
import { EventsService } from 'src/app/services/events-service';
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// import { EventsService } from 'src/app/services/events-service';
|
|
12
|
+
// import { TiledeskService } from '../../../services/tiledesk/tiledesk.service';
|
|
13
|
+
import { NetworkService } from '../../../services/network-service/network.service';
|
|
14
14
|
// import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
15
15
|
// import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
16
16
|
|
|
@@ -29,7 +29,8 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
29
29
|
public logger: LoggerService = LoggerInstance.getInstance();
|
|
30
30
|
public currentYear: any;
|
|
31
31
|
public browserLang: string;
|
|
32
|
-
public isOnline: true;
|
|
32
|
+
public isOnline: boolean = true;
|
|
33
|
+
public checkInternet: boolean;
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
@@ -42,7 +43,9 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
42
43
|
public kvDiffers: KeyValueDiffers,
|
|
43
44
|
public platform: Platform,
|
|
44
45
|
private translate: TranslateService,
|
|
45
|
-
private events: EventsService
|
|
46
|
+
// private events: EventsService,
|
|
47
|
+
// private tiledeskService: TiledeskService,
|
|
48
|
+
private networkService: NetworkService
|
|
46
49
|
) {
|
|
47
50
|
super(iterableDiffers, kvDiffers)
|
|
48
51
|
this.browserLang = this.translate.getBrowserLang();
|
|
@@ -65,20 +68,41 @@ export class IonListConversationsComponent extends ListConversationsComponent im
|
|
|
65
68
|
this.isApp = this.platform.is('ios') || this.platform.is('android')
|
|
66
69
|
this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - IS-APP ', this.isApp)
|
|
67
70
|
this.logger.log('[ION-LIST-CONVS-COMP] - ngOnInit - Platform', this.platform.platforms());
|
|
68
|
-
|
|
71
|
+
this.watchToConnectionStatus();
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
|
|
75
|
+
watchToConnectionStatus() {
|
|
76
|
+
|
|
77
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
78
|
+
this.checkInternet = isOnline
|
|
79
|
+
this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
80
|
+
|
|
81
|
+
// checking internet connection
|
|
82
|
+
if (this.checkInternet == true) {
|
|
83
|
+
|
|
84
|
+
this.isOnline = true;
|
|
85
|
+
} else {
|
|
86
|
+
this.isOnline = false;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// --------------------------------------------------
|
|
91
|
+
// subdsribe to event
|
|
92
|
+
// --------------------------------------------------
|
|
93
|
+
// subdcribeToWatchToConnectionStatus() {
|
|
94
|
+
// this.logger.log('[ION-LIST-CONVS-COMP] subdcribeToWatchToConnectionStatus ');
|
|
95
|
+
// // this.events.subscribe('uidConvSelected:changed', this.subscribeChangedConversationSelected);
|
|
96
|
+
// this.events.subscribe('internetisonline', (internetisonline) => {
|
|
97
|
+
// // user and time are the same arguments passed in `events.publish(user, time)`
|
|
98
|
+
// this.logger.log('[ION-LIST-CONVS-COMP] internetisonline ',internetisonline);
|
|
99
|
+
// if (internetisonline === true) {
|
|
100
|
+
// this.isOnline = true;
|
|
101
|
+
// } else {
|
|
102
|
+
// this.isOnline = false;
|
|
103
|
+
// }
|
|
104
|
+
// });
|
|
105
|
+
// }
|
|
82
106
|
|
|
83
107
|
|
|
84
108
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<ion-button expand="full" fill="clear" text-left class="advanced-info-accordion" (click)="openAdvancedInfoAccordion()">
|
|
2
2
|
<span class="absolute-text">
|
|
3
3
|
|
|
4
|
-
{{ translationMap
|
|
4
|
+
{{ translationMap?.get('LABEL_INFO_ADVANCED') }}
|
|
5
5
|
</span>
|
|
6
6
|
|
|
7
7
|
<ion-icon id="{{'absolute-icon_'+ teammateID}}" slot="end" name="chevron-down-outline" class="absolute-icon">
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<div class="attributes-title-wpr">
|
|
43
43
|
<span class="attributes-title">
|
|
44
44
|
<!-- {{ attr.key }} -->
|
|
45
|
-
{{ translationMap
|
|
45
|
+
{{ translationMap?.get(attr.key) }}
|
|
46
46
|
</span>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
@@ -77,10 +77,10 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
|
|
|
77
77
|
this.unsubscribe$.next();
|
|
78
78
|
this.unsubscribe$.complete();
|
|
79
79
|
this.member_array = []
|
|
80
|
-
console.log('InfoGroupComponent - router.events member_array :', this.member_array);
|
|
80
|
+
// console.log('InfoGroupComponent - router.events member_array :', this.member_array);
|
|
81
81
|
// this.pleaseDeleteMeEvent.emit();
|
|
82
82
|
|
|
83
|
-
if (this.groupDetail.hasOwnProperty("member_array")) {
|
|
83
|
+
if (this.groupDetail && this.groupDetail.hasOwnProperty("member_array")) {
|
|
84
84
|
// console.log('InfoGroupComponent - router.events has Property member_array :', this.groupDetail.hasOwnProperty("member_array"));
|
|
85
85
|
delete this.groupDetail['member_array'];
|
|
86
86
|
}
|
|
@@ -47,7 +47,9 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
47
47
|
|
|
48
48
|
/** */
|
|
49
49
|
initialize() {
|
|
50
|
-
|
|
50
|
+
if (this.translationMap) {
|
|
51
|
+
this.status = this.translationMap.get('LABEL_ACTIVE_NOW');
|
|
52
|
+
}
|
|
51
53
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - this.translationMap', this.translationMap);
|
|
52
54
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - this.status', this.status);
|
|
53
55
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - idUser ->', this.idUser);
|
|
@@ -68,7 +70,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
68
70
|
subscribtionKey = 'BSIsOnline';
|
|
69
71
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
70
72
|
if (!subscribtion) {
|
|
71
|
-
subscribtion =
|
|
73
|
+
subscribtion = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
72
74
|
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
73
75
|
if (data) {
|
|
74
76
|
const userId = data.uid;
|
|
@@ -78,7 +80,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
|
-
const subscribe = {key: subscribtionKey, value: subscribtion };
|
|
83
|
+
const subscribe = { key: subscribtionKey, value: subscribtion };
|
|
82
84
|
this.subscriptions.push(subscribe);
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -86,7 +88,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
86
88
|
subscribtionKey = 'BSLastOnline';
|
|
87
89
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
88
90
|
if (!subscribtion) {
|
|
89
|
-
subscribtion =
|
|
91
|
+
subscribtion = this.presenceService.BSLastOnline.subscribe((data: any) => {
|
|
90
92
|
this.logger.log('[USER-PRESENCE-COMP] $subs to BSLastOnline - data ', data);
|
|
91
93
|
if (data) {
|
|
92
94
|
const userId = data.uid;
|
|
@@ -96,7 +98,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
|
-
const subscribe = {key: subscribtionKey, value: subscribtion };
|
|
101
|
+
const subscribe = { key: subscribtionKey, value: subscribtion };
|
|
100
102
|
this.subscriptions.push(subscribe);
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -138,7 +140,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
138
140
|
const lastConnectionDate = setLastDateWithLabels(this.translationMap, timestamp);
|
|
139
141
|
this.logger.log('[USER-PRESENCE-COMP] userLastConnection - lastConnectionDate', lastConnectionDate);
|
|
140
142
|
this.lastConnectionDate = lastConnectionDate;
|
|
141
|
-
if (this.online === false
|
|
143
|
+
if (this.online === false) {
|
|
142
144
|
this.status = this.lastConnectionDate;
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
<ion-grid style="height: 100%;">
|
|
11
11
|
<ion-row class="ion-justify-content-center ion-align-items-center" style="height: 100%; flex-direction: column">
|
|
12
|
-
<span
|
|
12
|
+
<span *ngIf="isOnline === true"
|
|
13
13
|
style="color: #92949c; font-size: 16px;line-height: 18px;margin-top: -160px;">{{'PleaseSelectChatToStartMessaging'
|
|
14
14
|
| translate }}</span>
|
|
15
|
+
|
|
16
|
+
<span *ngIf="isOnline === false"
|
|
17
|
+
style="color: #92949c; font-size: 16px;line-height: 18px;margin-top: -160px;">Internet is slow or not working</span>
|
|
15
18
|
</ion-row>
|
|
16
19
|
</ion-grid>
|
|
17
20
|
</ion-content>
|
|
@@ -35,9 +35,11 @@ import { isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/uti
|
|
|
35
35
|
// Logger
|
|
36
36
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
37
37
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
38
|
+
|
|
38
39
|
import { Subject } from 'rxjs';
|
|
39
40
|
import { takeUntil } from 'rxjs/operators';
|
|
40
41
|
import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
|
|
42
|
+
import { NetworkService } from '../../services/network-service/network.service';
|
|
41
43
|
|
|
42
44
|
@Component({
|
|
43
45
|
selector: 'app-conversation-detail',
|
|
@@ -112,6 +114,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
112
114
|
messageType = messageType;
|
|
113
115
|
// info_content_child_enabled: boolean = false
|
|
114
116
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
public isOnline: boolean = true;
|
|
120
|
+
public checkInternet: boolean;
|
|
121
|
+
public msgCount: number
|
|
115
122
|
/**
|
|
116
123
|
* Constructor
|
|
117
124
|
* @param route
|
|
@@ -156,7 +163,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
156
163
|
public imageRepoService: ImageRepoService,
|
|
157
164
|
public presenceService: PresenceService,
|
|
158
165
|
public toastController: ToastController,
|
|
159
|
-
public tiledeskService: TiledeskService
|
|
166
|
+
public tiledeskService: TiledeskService,
|
|
167
|
+
private networkService: NetworkService
|
|
160
168
|
) {
|
|
161
169
|
|
|
162
170
|
// Change list on date change
|
|
@@ -189,7 +197,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
189
197
|
|
|
190
198
|
// }
|
|
191
199
|
// });
|
|
200
|
+
this.watchToConnectionStatus();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
watchToConnectionStatus() {
|
|
204
|
+
|
|
205
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
206
|
+
this.checkInternet = isOnline
|
|
207
|
+
// console.log('[CONVS-LIST-PAGE] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
208
|
+
|
|
209
|
+
// checking internet connection
|
|
210
|
+
if (this.checkInternet == true) {
|
|
192
211
|
|
|
212
|
+
this.isOnline = true;
|
|
213
|
+
} else {
|
|
214
|
+
this.isOnline = false;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
193
217
|
}
|
|
194
218
|
|
|
195
219
|
ngAfterViewInit() {
|
|
@@ -441,6 +465,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
441
465
|
const that = this;
|
|
442
466
|
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages);
|
|
443
467
|
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length);
|
|
468
|
+
this.msgCount = that.messages.length
|
|
444
469
|
setTimeout(() => {
|
|
445
470
|
if (!that.messages || that.messages.length === 0) {
|
|
446
471
|
this.showIonContent = true;
|
|
@@ -586,8 +611,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
586
611
|
}
|
|
587
612
|
}
|
|
588
613
|
|
|
589
|
-
|
|
590
|
-
if (type === 'file'
|
|
614
|
+
// || type === 'image'
|
|
615
|
+
if (type === 'file') {
|
|
591
616
|
|
|
592
617
|
if (msg) {
|
|
593
618
|
// msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
@@ -603,12 +628,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
603
628
|
msg = `[${metadata.name}](${metadata.src})`
|
|
604
629
|
}
|
|
605
630
|
}
|
|
606
|
-
|
|
607
|
-
//
|
|
608
|
-
//
|
|
631
|
+
|
|
632
|
+
// else if (type === 'image') {
|
|
633
|
+
// if (msg) {
|
|
634
|
+
// // msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
635
|
+
// msg = metadata.name + '\n' + msg
|
|
636
|
+
|
|
637
|
+
// } else {
|
|
638
|
+
|
|
639
|
+
// msg = metadata.name
|
|
640
|
+
// }
|
|
641
|
+
|
|
642
|
+
// }
|
|
643
|
+
|
|
609
644
|
|
|
610
645
|
(metadata) ? metadata = metadata : metadata = '';
|
|
611
646
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser);
|
|
647
|
+
|
|
612
648
|
if (msg && msg.trim() !== '' || type !== TYPE_MSG_TEXT) {
|
|
613
649
|
this.conversationHandlerService.sendMessage(
|
|
614
650
|
msg,
|
|
@@ -60,7 +60,7 @@ export class ConversationListPage implements OnInit {
|
|
|
60
60
|
|
|
61
61
|
public conversationType = 'active'
|
|
62
62
|
headerTitle: string;
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
|
|
65
65
|
constructor(
|
|
66
66
|
private router: Router,
|
|
@@ -213,9 +213,6 @@ export class ConversationListPage implements OnInit {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
216
|
// ------------------------------------------------------------------
|
|
220
217
|
// SUBSCRIPTIONS
|
|
221
218
|
// ------------------------------------------------------------------
|
|
@@ -248,7 +245,7 @@ export class ConversationListPage implements OnInit {
|
|
|
248
245
|
// });
|
|
249
246
|
|
|
250
247
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
251
|
-
this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
|
|
248
|
+
// this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
|
|
252
249
|
// that.conversationsChanged(conversations);
|
|
253
250
|
if (conversation) {
|
|
254
251
|
this.onImageLoaded(conversation)
|
|
@@ -257,7 +254,7 @@ export class ConversationListPage implements OnInit {
|
|
|
257
254
|
});
|
|
258
255
|
|
|
259
256
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
260
|
-
this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
|
|
257
|
+
// this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
|
|
261
258
|
// that.conversationsChanged(conversations)
|
|
262
259
|
if (conversation) {
|
|
263
260
|
this.onImageLoaded(conversation)
|
|
@@ -426,13 +423,15 @@ export class ConversationListPage implements OnInit {
|
|
|
426
423
|
this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant);
|
|
427
424
|
if (this.route.component['name'] !== "ConversationListPage") {
|
|
428
425
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
426
|
+
if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
|
|
427
|
+
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
428
|
+
this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
|
|
429
|
+
if (IDConv) {
|
|
430
|
+
this.setUidConvSelected(IDConv);
|
|
431
|
+
} else {
|
|
434
432
|
|
|
435
|
-
|
|
433
|
+
this.logger.log('[CONVS-LIST-PAGE] conversationWith 2 (else): ', IDConv);
|
|
434
|
+
}
|
|
436
435
|
}
|
|
437
436
|
}
|
|
438
437
|
}
|
|
@@ -493,7 +492,7 @@ export class ConversationListPage implements OnInit {
|
|
|
493
492
|
}
|
|
494
493
|
|
|
495
494
|
onConversationLoaded(conversation: ConversationModel) {
|
|
496
|
-
|
|
495
|
+
this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
|
|
497
496
|
const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT'];
|
|
498
497
|
const translationMap = this.translateService.translateLanguage(keys);
|
|
499
498
|
// Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
|
|
@@ -518,14 +517,41 @@ export class ConversationListPage implements OnInit {
|
|
|
518
517
|
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE;
|
|
519
518
|
|
|
520
519
|
} else if (conversation.type === "file") {
|
|
521
|
-
this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
|
|
520
|
+
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
|
|
522
521
|
const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
|
|
523
522
|
conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT;
|
|
524
523
|
}
|
|
525
|
-
}
|
|
524
|
+
} else {
|
|
525
|
+
if (conversation.type === "image") {
|
|
526
|
+
|
|
527
|
+
// this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
|
|
528
|
+
// this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
|
|
529
|
+
const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
|
|
530
|
+
|
|
531
|
+
conversation.last_message_text = SENT_AN_IMAGE;
|
|
532
|
+
|
|
533
|
+
}
|
|
534
|
+
// else if (conversation.type !== "text" && conversation.type !== "image") {
|
|
535
|
+
// // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
|
|
536
|
+
// const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
|
|
537
|
+
// conversation.last_message_text = SENT_AN_ATTACHMENT;
|
|
538
|
+
|
|
539
|
+
// }
|
|
540
|
+
}
|
|
526
541
|
}
|
|
527
542
|
}
|
|
528
543
|
|
|
544
|
+
// isMarkdownLink(last_message_text) {
|
|
545
|
+
// this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 1')
|
|
546
|
+
// var regex = /^(^|[\n\r])\s*1\.\s.*\s+1\.\s$/
|
|
547
|
+
// let matchRegex = false
|
|
548
|
+
// if (regex.test(last_message_text)) {
|
|
549
|
+
// this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 2')
|
|
550
|
+
// matchRegex = true
|
|
551
|
+
// return matchRegex
|
|
552
|
+
// }
|
|
553
|
+
// }
|
|
554
|
+
|
|
529
555
|
|
|
530
556
|
navigateByUrl(converationType: string, uidConvSelected: string) {
|
|
531
557
|
this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
|
|
@@ -655,11 +681,11 @@ export class ConversationListPage implements OnInit {
|
|
|
655
681
|
|
|
656
682
|
}, () => {
|
|
657
683
|
this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
|
|
658
|
-
|
|
684
|
+
|
|
659
685
|
});
|
|
660
686
|
}
|
|
661
687
|
|
|
662
|
-
archiveSupportGroupConv(tiledeskToken, project_id,conversationId) {
|
|
688
|
+
archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
|
|
663
689
|
this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ', project_id)
|
|
664
690
|
this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe(res => {
|
|
665
691
|
|
|
@@ -675,9 +701,6 @@ export class ConversationListPage implements OnInit {
|
|
|
675
701
|
}
|
|
676
702
|
|
|
677
703
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
704
|
public generateFake(count: number): Array<number> {
|
|
682
705
|
const indexes = [];
|
|
683
706
|
for (let i = 0; i < count; i++) {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<ion-item>
|
|
28
28
|
<ion-label color="primary" position="floating" floating> {{'AddACaption' | translate}}...</ion-label>
|
|
29
29
|
<!-- <ion-input clearInput></ion-input> -->
|
|
30
|
-
<ion-textarea #messageTextArea rows="1" autosize="false" auto-grow="true" [(ngModel)]="messageString"
|
|
30
|
+
<ion-textarea #messageTextArea #imageCaptionTexarea rows="1" autosize="false" auto-grow="true" [(ngModel)]="messageString"
|
|
31
31
|
(ionInput)="onChangeTextArea($event);" (keyup.enter)="pressedOnKeyboard($event, messageString);">
|
|
32
32
|
</ion-textarea>
|
|
33
33
|
</ion-item>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, OnInit, Input, Output, ViewChild, ElementRef, EventEmitter, HostListener } from '@angular/core';
|
|
1
|
+
import { Component, OnInit, Input, Output, ViewChild, ElementRef, EventEmitter, HostListener, AfterViewInit } from '@angular/core';
|
|
2
2
|
import { TYPE_MSG_IMAGE } from 'src/chat21-core/utils/constants';
|
|
3
3
|
import { NavParams, ModalController } from '@ionic/angular';
|
|
4
4
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
|
@@ -12,9 +12,10 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
|
12
12
|
templateUrl: './loader-preview.page.html',
|
|
13
13
|
styleUrls: ['./loader-preview.page.scss'],
|
|
14
14
|
})
|
|
15
|
-
export class LoaderPreviewPage implements OnInit {
|
|
15
|
+
export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
16
16
|
@ViewChild('thumbnailsPreview', { static: false }) thumbnailsPreview: ElementRef;
|
|
17
17
|
@ViewChild('messageTextArea', { static: false }) messageTextArea: ElementRef;
|
|
18
|
+
@ViewChild('imageCaptionTexarea', { static: false }) imageCaptionTexarea: any
|
|
18
19
|
// @Output() eventSendMessage = new EventEmitter<object>();
|
|
19
20
|
@Input() files: [any];
|
|
20
21
|
|
|
@@ -43,6 +44,17 @@ export class LoaderPreviewPage implements OnInit {
|
|
|
43
44
|
//this.fileChange(this.files[i]);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
ngAfterViewInit() {
|
|
48
|
+
if (this.imageCaptionTexarea) {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
// this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] set focus on ", this.messageTextArea);
|
|
51
|
+
// Keyboard.show() // for android
|
|
52
|
+
this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] ngAfterViewInit this.imageCaptionTexarea ", this.imageCaptionTexarea);
|
|
53
|
+
this.imageCaptionTexarea.setFocus();
|
|
54
|
+
|
|
55
|
+
}, 1000); //a least 150ms.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
46
58
|
|
|
47
59
|
ionViewDidEnter() {
|
|
48
60
|
this.logger.log('[LOADER-PREVIEW-PAGE] ionViewDidEnter thumbnailsPreview.nativeElement.offsetHeight', this.thumbnailsPreview.nativeElement.offsetHeight);
|
|
@@ -126,7 +138,7 @@ export class LoaderPreviewPage implements OnInit {
|
|
|
126
138
|
|
|
127
139
|
start_and_end(str) {
|
|
128
140
|
if (str.length > 70) {
|
|
129
|
-
return str.substr(0, 20) + '...' + str.substr(str.length-10, str.length);
|
|
141
|
+
return str.substr(0, 20) + '...' + str.substr(str.length - 10, str.length);
|
|
130
142
|
}
|
|
131
143
|
return str;
|
|
132
144
|
}
|
|
@@ -270,7 +282,7 @@ export class LoaderPreviewPage implements OnInit {
|
|
|
270
282
|
|
|
271
283
|
/** */
|
|
272
284
|
onChangeTextArea(e: any) {
|
|
273
|
-
|
|
285
|
+
this.logger.log('onChangeTextArea', e.target.clientHeight);
|
|
274
286
|
this.calculateHeightPreviewArea();
|
|
275
287
|
// try {
|
|
276
288
|
// let height: number = e.target.offsetHeight;
|
|
@@ -315,7 +327,7 @@ export class LoaderPreviewPage implements OnInit {
|
|
|
315
327
|
/** */
|
|
316
328
|
onSendMessage() {
|
|
317
329
|
this.logger.log('[LOADER-PREVIEW-PAGE] onSendMessage messageString:', this.messageString);
|
|
318
|
-
|
|
330
|
+
let file = this.selectedFiles.item(0);
|
|
319
331
|
const file4Load = new Image;
|
|
320
332
|
const nameImg = file.name;
|
|
321
333
|
const typeFile = file.type;
|
|
@@ -332,6 +344,7 @@ export class LoaderPreviewPage implements OnInit {
|
|
|
332
344
|
'uid': uid
|
|
333
345
|
};
|
|
334
346
|
this.viewCtrl.dismiss({ fileSelected: file, messageString: this.messageString, metadata: metadata, type: TYPE_MSG_IMAGE });
|
|
347
|
+
|
|
335
348
|
}
|
|
336
349
|
|
|
337
350
|
async onClose() {
|