@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.55-RC20
|
|
4
|
+
- Improve the method that solves the bug: if the chat is open on more than one tab, the previous ones disconnect
|
|
5
|
+
- Displays the message "sent an image" when the sender sends an image
|
|
6
|
+
- Removes the "setTimeout" set on the onStorageChanged event
|
|
7
|
+
|
|
8
|
+
### 3.0.55-RC19
|
|
9
|
+
- Fixes the bug: opening the "conversations info" side panel for support type conversations causes the chat to log out
|
|
10
|
+
|
|
11
|
+
### 3.0.55-RC18
|
|
12
|
+
- Fixes the bug: if the chat is open on more than one tab, the previous ones logging out
|
|
13
|
+
|
|
14
|
+
### 3.0.55-RC16
|
|
15
|
+
- Removes the image name displayed at the bottom of the image
|
|
16
|
+
- Removes the adaptation of the image caption width to the image size
|
|
17
|
+
|
|
18
|
+
### 3.0.55-RC15
|
|
19
|
+
- Fixes the bug: "ion-spinner" throws an error when the chat is offline
|
|
20
|
+
- Fixes the bug: in the component "info-group-component" if groupDetail is not defined throws the error "Cannot read hasOwnProperty of undefined"
|
|
21
|
+
- Fixes the bug: in the "advanced-info-accordion" component if translationMap is not defined throws the error "Cannot read properties of undefined (reading 'get')"
|
|
22
|
+
- Fixes the bug: in the component "user-presence.component" if translationMap is not defined throws the error "Cannot read properties of undefined (reading 'get')"
|
|
23
|
+
- Fixes the bug: if the image name is longer than the image width when uploading, it is displayed on the right side of the image
|
|
24
|
+
- Fixes the bug: if the user logs out of the dashboard and then logs in, the user in the chat is not logged in again
|
|
25
|
+
- Fixes the bug: if the file upload preview window is closed without sending the file, the windows does not reopen if the same file is selected
|
|
26
|
+
- Adds autofocus in the "caption" text area in the file upload preview window
|
|
27
|
+
|
|
28
|
+
### 3.0.55-RC14
|
|
29
|
+
- Implements Network service
|
|
30
|
+
- Displays, when the chat loses connection, the message "Waiting for network" at the top of the conversation list
|
|
31
|
+
- Displays, when the chat loses connection, the message "Internet is slow or not working" on the conversation details page
|
|
32
|
+
- Set the "user" variable to null when the user logs out of chat
|
|
33
|
+
|
|
3
34
|
### 3.0.55-RC12
|
|
4
35
|
- Fixes the bug: when a file is uploaded via drag & drop, the message "Failed to upload: the format is not supported" is displayed even if fileUploadAccept is set to "* / *" (accept all)
|
|
5
36
|
- Fixes the bug: the left side panel "conversation list" is not displayed on Safari
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storag
|
|
|
5
5
|
import { Component, ViewChild, NgZone, OnInit, HostListener, ElementRef, Renderer2, } from '@angular/core';
|
|
6
6
|
import { Config, Platform, IonRouterOutlet, IonSplitPane, NavController, MenuController, AlertController, IonNav, ToastController } from '@ionic/angular';
|
|
7
7
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
8
|
-
import { Subscription } from 'rxjs';
|
|
8
|
+
import { Subscription, VirtualTimeScheduler } from 'rxjs';
|
|
9
9
|
import { ModalController } from '@ionic/angular';
|
|
10
10
|
|
|
11
11
|
// import * as firebase from 'firebase/app';
|
|
@@ -49,9 +49,12 @@ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk
|
|
|
49
49
|
import { NotificationsService } from 'src/chat21-core/providers/abstract/notifications.service';
|
|
50
50
|
import { getImageUrlThumbFromFirebasestorage } from 'src/chat21-core/utils/utils-user';
|
|
51
51
|
|
|
52
|
-
import { Network } from '@ionic-native/network/ngx';
|
|
53
|
-
import { Observable, Observer, fromEvent, merge, of } from 'rxjs';
|
|
54
|
-
import { mapTo } from 'rxjs/operators';
|
|
52
|
+
// import { Network } from '@ionic-native/network/ngx';
|
|
53
|
+
// import { Observable, Observer, fromEvent, merge, of } from 'rxjs';
|
|
54
|
+
// import { mapTo } from 'rxjs/operators';
|
|
55
|
+
import { TiledeskService } from './services/tiledesk/tiledesk.service';
|
|
56
|
+
import { NetworkService } from './services/network-service/network.service';
|
|
57
|
+
import * as PACKAGE from 'package.json';
|
|
55
58
|
|
|
56
59
|
@Component({
|
|
57
60
|
selector: 'app-root',
|
|
@@ -63,7 +66,7 @@ export class AppComponent implements OnInit {
|
|
|
63
66
|
@ViewChild('sidebarNav', { static: false }) sidebarNav: IonNav;
|
|
64
67
|
@ViewChild('detailNav', { static: false }) detailNav: IonRouterOutlet;
|
|
65
68
|
|
|
66
|
-
public appIsOnline$: Observable<boolean> = undefined;
|
|
69
|
+
// public appIsOnline$: Observable<boolean> = undefined;
|
|
67
70
|
checkInternet: boolean;
|
|
68
71
|
|
|
69
72
|
private subscription: Subscription;
|
|
@@ -89,6 +92,8 @@ export class AppComponent implements OnInit {
|
|
|
89
92
|
private modalOpen: boolean = false;
|
|
90
93
|
private hadBeenCalledOpenModal: boolean = false;
|
|
91
94
|
public missingConnectionToast: any
|
|
95
|
+
public executedInitializeAppByWatchConnection: boolean = false;
|
|
96
|
+
private version: string;
|
|
92
97
|
|
|
93
98
|
constructor(
|
|
94
99
|
private platform: Platform,
|
|
@@ -122,30 +127,37 @@ export class AppComponent implements OnInit {
|
|
|
122
127
|
private translateService: CustomTranslateService,
|
|
123
128
|
public notificationsService: NotificationsService,
|
|
124
129
|
public toastController: ToastController,
|
|
125
|
-
private network: Network
|
|
130
|
+
// private network: Network,
|
|
131
|
+
// private tiledeskService: TiledeskService,
|
|
132
|
+
private networkService: NetworkService
|
|
126
133
|
) {
|
|
127
|
-
|
|
134
|
+
this.logger.log('[APP-COMP] HELLO Constuctor !!!!!!!')
|
|
128
135
|
// HACK: fix toast not presented when offline, due to lazy loading the toast controller.
|
|
129
|
-
this.toastController.create({ animated: false }).then(t => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
136
|
+
// this.toastController.create({ animated: false }).then(t => {
|
|
137
|
+
// console.log('[APP-COMP] toastController create')
|
|
138
|
+
// t.present();
|
|
139
|
+
// t.dismiss();
|
|
140
|
+
// });
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
|
|
137
144
|
/**
|
|
138
145
|
*/
|
|
139
146
|
ngOnInit() {
|
|
140
|
-
|
|
147
|
+
this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
|
|
141
148
|
this.logger.info('[APP-COMP] ngOnInit -->', this.route.snapshot.params);
|
|
142
149
|
|
|
143
150
|
this.initializeApp();
|
|
151
|
+
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
|
|
155
|
+
|
|
147
156
|
/** */
|
|
148
157
|
initializeApp() {
|
|
158
|
+
|
|
159
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - initializeApp');
|
|
160
|
+
this.logger.log('[APP-COMP] HELLO initializeApp !!!!!!!')
|
|
149
161
|
this.logger.info('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
|
|
150
162
|
|
|
151
163
|
if (!this.platform.is('cordova')) {
|
|
@@ -157,6 +169,8 @@ export class AppComponent implements OnInit {
|
|
|
157
169
|
|
|
158
170
|
const appconfig = this.appConfigProvider.getConfig();
|
|
159
171
|
this.logger.info('[APP-COMP] appconfig: ', appconfig)
|
|
172
|
+
this.version = PACKAGE.version;
|
|
173
|
+
this.logger.info('[APP-COMP] version: ', this.version)
|
|
160
174
|
|
|
161
175
|
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
162
176
|
this.logger.info('[APP-COMP] logLevel: ', appconfig.logLevel);
|
|
@@ -166,7 +180,7 @@ export class AppComponent implements OnInit {
|
|
|
166
180
|
|
|
167
181
|
this.persistence = appconfig.authPersistence;
|
|
168
182
|
|
|
169
|
-
|
|
183
|
+
|
|
170
184
|
this.notificationsEnabled = true;
|
|
171
185
|
this.zone = new NgZone({}); // a cosa serve?
|
|
172
186
|
|
|
@@ -206,94 +220,86 @@ export class AppComponent implements OnInit {
|
|
|
206
220
|
// ---------------------------------------
|
|
207
221
|
// Watch to network status
|
|
208
222
|
// ---------------------------------------
|
|
209
|
-
|
|
210
|
-
// this.watchToConnectionStatus();
|
|
211
|
-
// }
|
|
223
|
+
this.watchToConnectionStatus();
|
|
212
224
|
});
|
|
213
225
|
}
|
|
214
226
|
|
|
215
227
|
|
|
216
228
|
|
|
217
229
|
watchToConnectionStatus() {
|
|
218
|
-
this.checkInternetFunc().subscribe(isOnline => {
|
|
230
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
219
231
|
this.checkInternet = isOnline
|
|
220
|
-
|
|
232
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
221
233
|
|
|
222
234
|
// checking internet connection
|
|
223
235
|
if (this.checkInternet == true) {
|
|
236
|
+
// this.events.publish('internetisonline', true);
|
|
224
237
|
// show success alert if internet is working
|
|
225
238
|
// alert('Internet is working.')
|
|
226
239
|
this.logger.log('[APP-COMP] - watchToConnectionStatus - Internet is working.')
|
|
227
|
-
this.logger.log('[APP-COMP] - watchToConnectionStatus - this.missingConnectionToast', this.missingConnectionToast)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
// this.logger.log('[APP-COMP] - watchToConnectionStatus - this.missingConnectionToast', this.missingConnectionToast)
|
|
241
|
+
if (!checkPlatformIsMobile()) {
|
|
242
|
+
const elemIonNav = <HTMLElement>document.querySelector('ion-nav');
|
|
243
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - desktop * elemIonNav *', elemIonNav)
|
|
244
|
+
|
|
245
|
+
if (this.executedInitializeAppByWatchConnection === false) {
|
|
246
|
+
setTimeout(() => {
|
|
247
|
+
const elemIonNavchildNodes = elemIonNav.childNodes;
|
|
248
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - elemIonNavchildNodes ', elemIonNavchildNodes);
|
|
249
|
+
|
|
250
|
+
if (elemIonNavchildNodes.length === 0) {
|
|
251
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - elemIonNavchildNodes HERE YES', elemIonNavchildNodes);
|
|
252
|
+
|
|
253
|
+
this.initializeApp();
|
|
254
|
+
this.executedInitializeAppByWatchConnection = true;
|
|
255
|
+
}
|
|
256
|
+
}, 2000);
|
|
238
257
|
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
258
|
+
} else if (checkPlatformIsMobile()) {
|
|
259
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile ')
|
|
260
|
+
const elemIonRouterOutlet = <HTMLElement>document.querySelector('ion-router-outlet');
|
|
261
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile * elemIonRouterOutlet *', elemIonRouterOutlet)
|
|
262
|
+
if (this.executedInitializeAppByWatchConnection === false) {
|
|
263
|
+
setTimeout(() => {
|
|
264
|
+
const childElementCount = elemIonRouterOutlet.childElementCount;
|
|
265
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - mobile * childElementCount *', childElementCount)
|
|
266
|
+
if (childElementCount === 1) {
|
|
267
|
+
this.initializeApp();
|
|
268
|
+
this.executedInitializeAppByWatchConnection = true;
|
|
269
|
+
}
|
|
270
|
+
}, 2000);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
253
273
|
}
|
|
254
274
|
else {
|
|
255
|
-
|
|
256
|
-
// --------------------------------------------------
|
|
257
|
-
// Publish event
|
|
258
|
-
// --------------------------------------------------
|
|
259
|
-
// this.events.publish('internetisonline', false);
|
|
260
|
-
|
|
261
|
-
// show danger alert if net internet not working
|
|
262
|
-
// alert('Internet is slow or not working.')
|
|
263
|
-
// this.presentMissingConnectionToast();
|
|
264
|
-
|
|
265
|
-
this.logger.log('[APP-COMP] - watchToConnectionStatus - Internet is slow or not working.')
|
|
266
|
-
// --------------------------------------------------
|
|
267
|
-
// Publish event
|
|
268
|
-
// --------------------------------------------------
|
|
269
|
-
// this.events.publish('internetisonline', false);
|
|
275
|
+
this.logger.log('[APP-COMP] - watchToConnectionStatus - Internet is slow or not working.');
|
|
270
276
|
}
|
|
271
277
|
});
|
|
272
278
|
}
|
|
273
279
|
|
|
274
|
-
checkInternetFunc() {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
280
|
+
// checkInternetFunc() {
|
|
281
|
+
// if (!window || !navigator || !('onLine' in navigator)) return;
|
|
282
|
+
|
|
283
|
+
// this.appIsOnline$ = Observable.create(observer => {
|
|
284
|
+
// observer.next(true);
|
|
285
|
+
// }).pipe(mapTo(true));
|
|
286
|
+
|
|
287
|
+
// if (this.platform.is('cordova')) {
|
|
288
|
+
// // on Device - when platform is cordova
|
|
289
|
+
// this.appIsOnline$ = merge(
|
|
290
|
+
// this.network.onConnect().pipe(mapTo(true)),
|
|
291
|
+
// this.network.onDisconnect().pipe(mapTo(false))
|
|
292
|
+
// );
|
|
293
|
+
// } else {
|
|
294
|
+
// // on Browser - when platform is Browser
|
|
295
|
+
// this.appIsOnline$ = merge(
|
|
296
|
+
// of(navigator.onLine),
|
|
297
|
+
// fromEvent(window, 'online').pipe(mapTo(true)),
|
|
298
|
+
// fromEvent(window, 'offline').pipe(mapTo(false))
|
|
299
|
+
// );
|
|
300
|
+
// }
|
|
301
|
+
// return this.appIsOnline$
|
|
302
|
+
// }
|
|
297
303
|
|
|
298
304
|
getRouteParamsAndSetLoggerConfig() {
|
|
299
305
|
const appconfig = this.appConfigProvider.getConfig();
|
|
@@ -501,6 +507,7 @@ export class AppComponent implements OnInit {
|
|
|
501
507
|
} else {
|
|
502
508
|
this.platformIs = PLATFORM_DESKTOP;
|
|
503
509
|
this.logger.debug('[APP-COMP] PLATFORM_DESKTOP ', this.navService);
|
|
510
|
+
|
|
504
511
|
this.navService.setRoot(ConversationListPage, {});
|
|
505
512
|
|
|
506
513
|
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
@@ -685,7 +692,7 @@ export class AppComponent implements OnInit {
|
|
|
685
692
|
that.removePresenceAndLogout();
|
|
686
693
|
} else {
|
|
687
694
|
that.removePresenceAndLogout();
|
|
688
|
-
that.presentToast();
|
|
695
|
+
// that.presentToast();
|
|
689
696
|
}
|
|
690
697
|
})
|
|
691
698
|
}
|
|
@@ -844,13 +851,55 @@ export class AppComponent implements OnInit {
|
|
|
844
851
|
}
|
|
845
852
|
}
|
|
846
853
|
|
|
854
|
+
// Storage event not firing: This won't work on the same page that is making the changes
|
|
855
|
+
// https://stackoverflow.com/questions/35865481/storage-event-not-firing
|
|
856
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
|
|
847
857
|
@HostListener('window:storage', ['$event'])
|
|
848
858
|
onStorageChanged(event: any) {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
859
|
+
// console.log('[APP-COMP] - onStorageChanged event', event)
|
|
860
|
+
// console.log('[APP-COMP] - onStorageChanged tiledeskToken', this.appStorageService.getItem('tiledeskToken'))
|
|
861
|
+
// const storage = event.storageArea;
|
|
862
|
+
// console.log('[APP-COMP] - onStorageChanged event storage', storage)
|
|
863
|
+
|
|
864
|
+
// setTimeout(() => {
|
|
865
|
+
// if (storage && storage['chat_sv5__tiledeskToken'] === undefined) {
|
|
866
|
+
// this.logger.log('[APP-COMP] - onStorageChanged event storage chat_sv5__tiledeskToken', storage['chat_sv5__tiledeskToken'])
|
|
867
|
+
// this.tiledeskAuthService.logOut()
|
|
868
|
+
// this.messagingAuthService.logout();
|
|
869
|
+
// // this.events.publish('profileInfoButtonClick:logout', true);
|
|
870
|
+
// this.conversationsHandlerService.conversations = [];
|
|
871
|
+
// } else if (storage && storage['chat_sv5__tiledeskToken']) {
|
|
872
|
+
|
|
873
|
+
// this.logger.log('[APP-COMP] - onStorageChanged event storage chat_sv5__tiledeskToken * IS DEFINED *')
|
|
874
|
+
// const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
875
|
+
|
|
876
|
+
// if (!currentUser) {
|
|
877
|
+
// window.location.reload();
|
|
878
|
+
// }
|
|
879
|
+
|
|
880
|
+
// }
|
|
881
|
+
// }, 1000);
|
|
882
|
+
|
|
883
|
+
// else {
|
|
884
|
+
// console.log('[APP-COMP] - onStorageChanged event storage chat_sv5__tiledeskToken', storage['chat_sv5__tiledeskToken'])
|
|
885
|
+
// }
|
|
886
|
+
|
|
887
|
+
// setTimeout(() => {
|
|
888
|
+
if (this.appStorageService.getItem('tiledeskToken') === null) {
|
|
889
|
+
this.tiledeskAuthService.logOut()
|
|
890
|
+
this.messagingAuthService.logout();
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
|
|
894
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
895
|
+
if (currentUser) {
|
|
896
|
+
console.log('[APP-COMP] - onStorageChanged currentUser', currentUser)
|
|
897
|
+
} else {
|
|
898
|
+
// this.initializeApp();
|
|
899
|
+
window.location.reload();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
// }, 1000);
|
|
854
903
|
}
|
|
855
904
|
|
|
856
905
|
}
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
|
|
59
59
|
<div class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)"
|
|
60
60
|
class="msg_info_container">
|
|
61
|
-
<chat-info-message class="messages"
|
|
61
|
+
<chat-info-message class="messages"
|
|
62
|
+
[message]="message">
|
|
62
63
|
</chat-info-message>
|
|
63
64
|
</div>
|
|
64
65
|
|
|
@@ -66,10 +67,13 @@
|
|
|
66
67
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
|
|
67
68
|
|
|
68
69
|
<!--backgroundColor non viene ancora usato -->
|
|
69
|
-
<chat-bubble-message
|
|
70
|
+
<chat-bubble-message
|
|
71
|
+
class="messages msg_sent" id="{{'message'+'_'+ i}}"
|
|
70
72
|
[ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}" [message]="message"
|
|
71
|
-
[textColor]="'col-msg-sent'"
|
|
72
|
-
(
|
|
73
|
+
[textColor]="'col-msg-sent'"
|
|
74
|
+
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
75
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
76
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
73
77
|
</chat-bubble-message>
|
|
74
78
|
|
|
75
79
|
<!-- icon status message -->
|
|
@@ -95,9 +99,12 @@
|
|
|
95
99
|
|
|
96
100
|
<!--backgroundColor non viene ancora usato -->
|
|
97
101
|
|
|
98
|
-
<chat-bubble-message class="messages msg_receive"
|
|
102
|
+
<chat-bubble-message class="messages msg_receive"
|
|
103
|
+
[message]="message"
|
|
104
|
+
[textColor]="'black'"
|
|
99
105
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
100
|
-
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
106
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
107
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
101
108
|
</chat-bubble-message>
|
|
102
109
|
</div>
|
|
103
110
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
<div [ngStyle]
|
|
2
|
-
<div *ngIf="loading" class="loader" [ngStyle]
|
|
3
|
-
<img
|
|
4
|
-
class="message-contentX message-content-imageX"
|
|
5
|
-
[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</
|
|
1
|
+
<div [ngStyle]="{ 'max-width': width +'px', 'max-height': height +'px' }" style="position: relative; ">
|
|
2
|
+
<div *ngIf="loading" class="loader" [ngStyle]="{ 'width': width +'px', 'height': height +'px' }"></div>
|
|
3
|
+
<img style="cursor:pointer" [tooltip]="timeTooltipRight" [options]="tooltipOptions" placement="bottom"
|
|
4
|
+
content-type="template" class="message-contentX message-content-imageX" [ngClass]="{'isLoadingImage': loading}"
|
|
5
|
+
[src]="metadata.src" (load)="onLoaded($event)" (click)="downloadImage(metadata.src, metadata.name)" />
|
|
6
|
+
|
|
7
|
+
<ng-template #timeTooltipRight>
|
|
8
|
+
<span>{{ tooltipMessage }}</span>
|
|
9
|
+
</ng-template>
|
|
10
|
+
</div>
|
|
@@ -11,17 +11,49 @@ export class ImageComponent implements OnInit {
|
|
|
11
11
|
@Input() width: string;
|
|
12
12
|
@Input() height: number;
|
|
13
13
|
@Output() onImageRendered = new EventEmitter<boolean>();
|
|
14
|
+
|
|
14
15
|
loading: boolean = true
|
|
16
|
+
tooltipMessage: string;
|
|
17
|
+
|
|
18
|
+
tooltipOptions = {
|
|
19
|
+
'show-delay': 0,
|
|
20
|
+
'tooltip-class': 'chat-tooltip',
|
|
21
|
+
'theme': 'light',
|
|
22
|
+
'shadow': false,
|
|
23
|
+
'hide-delay-mobile': 0,
|
|
24
|
+
'hideDelayAfterClick': 3000,
|
|
25
|
+
'hide-delay': 200
|
|
26
|
+
};
|
|
15
27
|
|
|
16
28
|
constructor() { }
|
|
17
29
|
|
|
18
30
|
ngOnInit() {
|
|
31
|
+
this.getBrowserLanguageAndTranslateTooltipMsg()
|
|
32
|
+
}
|
|
33
|
+
getBrowserLanguageAndTranslateTooltipMsg() {
|
|
34
|
+
var userLang = navigator.language;
|
|
35
|
+
console.log('Image COMP - userLang ', userLang)
|
|
36
|
+
if (userLang === 'en') {
|
|
37
|
+
this.tooltipMessage = "Click to download"
|
|
38
|
+
} else {
|
|
39
|
+
this.tooltipMessage = "Clicca per scaricare"
|
|
40
|
+
}
|
|
19
41
|
}
|
|
20
42
|
|
|
21
|
-
onLoaded(event){
|
|
43
|
+
onLoaded(event) {
|
|
22
44
|
this.loading = false
|
|
23
45
|
this.onImageRendered.emit(true)
|
|
24
46
|
}
|
|
25
47
|
|
|
26
|
-
|
|
48
|
+
downloadImage(url: string, fileName: string) {
|
|
49
|
+
// console.log('Image COMP - IMAGE URL ', url)
|
|
50
|
+
// console.log('Image COMP - IMAGE FILENAME ', fileName)
|
|
51
|
+
const a: any = document.createElement('a');
|
|
52
|
+
a.href = url;
|
|
53
|
+
a.download = fileName;
|
|
54
|
+
document.body.appendChild(a);
|
|
55
|
+
a.style = 'display: none';
|
|
56
|
+
a.click();
|
|
57
|
+
a.remove();
|
|
58
|
+
}
|
|
27
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!-- [ngStyle] = "{ 'width': media_width +'px' }" -->
|
|
2
|
-
<p #messageEl class="message_innerhtml marked"
|
|
1
|
+
<!-- [ngStyle] = "{ 'width': message.type === 'image' ? media_width +'px' : '' }" -->
|
|
2
|
+
<p #messageEl class="message_innerhtml marked"
|
|
3
3
|
[innerHTML]="printMessage(text, messageEl, this) | htmlEntiesEncode | marked"
|
|
4
4
|
[ngStyle]="{'color': '$'+ color }">
|
|
5
5
|
</p>
|
|
@@ -23,20 +23,37 @@
|
|
|
23
23
|
</div> -->
|
|
24
24
|
|
|
25
25
|
<!-- -------------------------------------------------------------------------- -->
|
|
26
|
-
<!-- New -->
|
|
26
|
+
<!-- New <ion-spinner class="spinner-middle" style="margin-left: 19px;"></ion-spinner> -->
|
|
27
27
|
<!-- -------------------------------------------------------------------------- -->
|
|
28
|
-
|
|
29
|
-
<ion-
|
|
30
|
-
|
|
28
|
+
<ion-item *ngIf="isOnline === false" button="true" lines="none" class="ion-no-padding waiting-for-connection">
|
|
29
|
+
<ion-avatar item-start>
|
|
30
|
+
<div class="sk-fading-circle">
|
|
31
|
+
<div class="sk-circle1 sk-circle"></div>
|
|
32
|
+
<div class="sk-circle2 sk-circle"></div>
|
|
33
|
+
<div class="sk-circle3 sk-circle"></div>
|
|
34
|
+
<div class="sk-circle4 sk-circle"></div>
|
|
35
|
+
<div class="sk-circle5 sk-circle"></div>
|
|
36
|
+
<div class="sk-circle6 sk-circle"></div>
|
|
37
|
+
<div class="sk-circle7 sk-circle"></div>
|
|
38
|
+
<div class="sk-circle8 sk-circle"></div>
|
|
39
|
+
<div class="sk-circle9 sk-circle"></div>
|
|
40
|
+
<div class="sk-circle10 sk-circle"></div>
|
|
41
|
+
<div class="sk-circle11 sk-circle"></div>
|
|
42
|
+
<div class="sk-circle12 sk-circle"></div>
|
|
43
|
+
</div>
|
|
44
|
+
</ion-avatar>
|
|
45
|
+
<ion-label part="message-text" class="waiting-for-network-msg"> Waiting for network</ion-label>
|
|
46
|
+
</ion-item>
|
|
31
47
|
|
|
32
|
-
<ion-item button="true" lines="none" class="ion-no-padding"
|
|
33
|
-
(click)="openConversationByID(conversation)">
|
|
48
|
+
<ion-item button="true" lines="none" class="ion-no-padding" [class.ion-selected]="conversation.uid === uidConvSelected"
|
|
49
|
+
*ngFor="let conversation of listConversations" (click)="openConversationByID(conversation)">
|
|
34
50
|
<div tabindex="0"></div>
|
|
35
51
|
|
|
36
52
|
<!-- <div [class.selected]="conversation.uid === uidConvSelected"></div> -->
|
|
37
53
|
<ion-avatar item-start>
|
|
38
54
|
<!-- [style.background-color]="conversation.color" -->
|
|
39
|
-
<div #avatarPlaceholder class="avatar-placeholder"
|
|
55
|
+
<div #avatarPlaceholder class="avatar-placeholder"
|
|
56
|
+
[ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + conversation.color + ')'}"
|
|
40
57
|
[innerHTML]="conversation.avatar"></div>
|
|
41
58
|
<div *ngIf="conversation.image" #avatarImage class="avatar-profile"
|
|
42
59
|
[style.background-image]="'url(' + conversation.image + ')'"></div>
|
|
@@ -56,12 +73,14 @@
|
|
|
56
73
|
[innerHTML]="conversation.last_message_text"></p> -->
|
|
57
74
|
|
|
58
75
|
<!-- <div *ngIf="conversation.type === 'image'" class="icon-image-before-msg-wpr"> -->
|
|
59
|
-
<ion-icon *ngIf="conversation.type === 'image' && conversation.type !== 'file' " name="image-outline"
|
|
60
|
-
|
|
76
|
+
<ion-icon *ngIf="conversation.type === 'image' && conversation.type !== 'file' " name="image-outline"
|
|
77
|
+
class="icon-image-before-msg"></ion-icon>
|
|
78
|
+
<ion-icon *ngIf="conversation.type === 'file' && conversation.type !== 'image'" name="attach-outline"
|
|
79
|
+
class="icon-attach-before-msg"></ion-icon>
|
|
61
80
|
<!-- </div> -->
|
|
62
81
|
<!-- [innerHTML]="conversation.last_message_text" -->
|
|
63
82
|
<span [class.not-read]="conversation.is_new">
|
|
64
|
-
|
|
83
|
+
{{ conversation.last_message_text }}
|
|
65
84
|
</span>
|
|
66
85
|
</div>
|
|
67
86
|
</ion-label>
|
|
@@ -84,20 +103,22 @@
|
|
|
84
103
|
|
|
85
104
|
<div item-end *ngIf="conversation?.archived" class="achived-icon-wpr">
|
|
86
105
|
<span *ngIf="(conversation.timestamp | amDateFormat:'YYYY') === currentYear" class="time-in-archived">
|
|
87
|
-
{{browserLang === 'it' ? (conversation.timestamp| amDateFormat:'DD MMM') : (conversation.timestamp |
|
|
88
|
-
|
|
106
|
+
{{browserLang === 'it' ? (conversation.timestamp| amDateFormat:'DD MMM') : (conversation.timestamp |
|
|
107
|
+
amDateFormat:'MMM DD')}}
|
|
108
|
+
|
|
89
109
|
<!-- {{conversation.timestamp | amDateFormat:'DD MMM'}} -->
|
|
90
110
|
</span>
|
|
91
111
|
<span *ngIf="(conversation.timestamp | amDateFormat:'YYYY') !== currentYear" class="time-in-archived">
|
|
92
|
-
{{browserLang === 'it' ? (conversation.timestamp| amDateFormat:'DD MMM') : (conversation.timestamp |
|
|
112
|
+
{{browserLang === 'it' ? (conversation.timestamp| amDateFormat:'DD MMM') : (conversation.timestamp |
|
|
113
|
+
amDateFormat:'MMM DD YYYY')}}
|
|
93
114
|
<!-- {{conversation.timestamp | amDateFormat:'DD MMM YYYY'}} -->
|
|
94
115
|
</span>
|
|
95
116
|
<i class="material-icons" item-end style="font-size: 15px;font-weight: 400;color: #666666;"> history </i>
|
|
96
117
|
</div>
|
|
97
118
|
|
|
98
119
|
<!-- && !conversation?.archived -->
|
|
99
|
-
<div item-end class="notification_point"
|
|
100
|
-
|
|
120
|
+
<div item-end class="notification_point" [ngClass]="{'notification_point-on-desktop': !isApp }"
|
|
121
|
+
*ngIf="conversation.is_new">
|
|
101
122
|
</div>
|
|
102
123
|
|
|
103
124
|
</ion-item>
|