@chat21/chat21-ionic 3.0.93 → 3.0.95

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 (23) hide show
  1. package/.github/workflows/docker-community-push-latest.yml +1 -1
  2. package/.github/workflows/docker-image-tag-community-tag-push.yml +1 -1
  3. package/CHANGELOG.md +11 -0
  4. package/package.json +1 -1
  5. package/src/app/app.component.ts +5 -5
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  7. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +1 -1
  8. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +12 -2
  9. package/src/app/chatlib/conversation-detail/message/text/text.component.scss +1 -1
  10. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -2
  11. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +2 -13
  12. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +1 -1
  13. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -11
  14. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +0 -3
  15. package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +1 -34
  16. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +0 -6
  17. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +0 -1
  18. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +2 -12
  19. package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +0 -3
  20. package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +0 -2
  21. package/src/chat21-core/providers/native/native-upload-service.ts +1 -0
  22. package/src/chat21-core/utils/utils-message.ts +1 -1
  23. package/src/chat21-core/utils/utils.ts +99 -124
@@ -14,7 +14,7 @@ jobs:
14
14
  steps:
15
15
  - uses: actions/checkout@v2
16
16
  name: Check out the repo
17
- - uses: docker/build-push-action@v1
17
+ - uses: docker/build-push-action@v2
18
18
  with:
19
19
  username: ${{ secrets.DOCKERHUB_USERNAME }}
20
20
  password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -13,7 +13,7 @@ jobs:
13
13
  - name: Check out the repo
14
14
  uses: actions/checkout@v2
15
15
  - name: Push to Docker Hub
16
- uses: docker/build-push-action@v1
16
+ uses: docker/build-push-action@v2
17
17
  with:
18
18
  username: ${{ secrets.DOCKERHUB_USERNAME }}
19
19
  password: ${{ secrets.DOCKERHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.95 in PROD
4
+ - bug-fixed: cannot upload PDF files
5
+
6
+ ### 3.0.95-rc.1
7
+ - added: custom colors to senderFullname to better distinguish the user
8
+ - bug-fixed: cannot read text.trim() of undefined if no text is sent with an image
9
+ - bug-fixed: markdown not split work correctly
10
+
11
+ ### 3.0.94 in PROD
12
+ - bug-fixed: error getting projectId during lead detail for conversations with more than 4 segment
13
+
3
14
  ### 3.0.93 in PROD
4
15
  - added: goToProfile sidebar-user-detail feature
5
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.93",
4
+ "version": "3.0.95",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -757,11 +757,11 @@ export class AppComponent implements OnInit {
757
757
  this.IS_ONLINE = false;
758
758
  // clearTimeout(this.timeModalLogin);
759
759
  // this.timeModalLogin = setTimeout(() => {
760
- if (!this.hadBeenCalledOpenModal) {
761
- this.authModal = this.presentModal('initAuthentication');
762
- this.hadBeenCalledOpenModal = true;
763
- }
764
- // this.goToDashboardLogin()
760
+ // if (!this.hadBeenCalledOpenModal) {
761
+ // this.authModal = this.presentModal('initAuthentication');
762
+ // this.hadBeenCalledOpenModal = true;
763
+ // }
764
+ this.goToDashboardLogin()
765
765
  // }, 1000);
766
766
  }
767
767
  }
@@ -121,7 +121,7 @@
121
121
  <!--backgroundColor non viene ancora usato -->
122
122
  <chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
123
123
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
124
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
124
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
125
125
  [class.emoticon]="isEmojii(message?.text)"
126
126
  [ngStyle]="{'background': stylesMap.get('bubbleSentBackground'), 'color': stylesMap.get('bubbleSentTextColor')}"
127
127
  [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
@@ -168,7 +168,7 @@
168
168
  <!--backgroundColor non viene ancora usato -->
169
169
  <chat-bubble-message class="messages msg_receive" id="message_msg_receive"
170
170
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
171
- [class.no-background]="(isImage(message) || isFrame(message)) && message?.text.trim() === '' "
171
+ [class.no-background]="(isImage(message) || isFrame(message)) && message?.text && message?.text.trim() === '' "
172
172
  [class.emoticon]="isEmojii(message?.text)"
173
173
  [ngStyle]="{'background': stylesMap?.get('bubbleReceivedBackground'), 'color': stylesMap.get('bubbleReceivedTextColor')}"
174
174
  [isSameSender]="isSameSender(message?.sender, i)"
@@ -18,7 +18,7 @@
18
18
  <div>
19
19
 
20
20
  <div *ngIf="messageType(MESSAGE_TYPE_OTHERS, message) && !isSameSender"
21
- [style.color]="convertColorToRGBA(fontColor, 65)"
21
+ [style.color]="fullnameColor"
22
22
  [ngStyle]="{'padding': (isImage(message) || isFrame(message))? '10px 16px 8px 16px': '10px 8px 0px 8px'}" class="message_sender_fullname">
23
23
  {{message?.sender_fullname}}
24
24
  </div>
@@ -10,7 +10,8 @@ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk
10
10
  import * as moment from 'moment';
11
11
  import { ModalController, PopoverController } from '@ionic/angular';
12
12
  import { convertColorToRGBA } from 'src/chat21-core/utils/utils';
13
- import { BubbleInfoPopoverComponent } from 'src/app/components/bubbleMessageInfo-popover/bubbleinfo-popover.component';
13
+ import { getColorBck } from 'src/chat21-core/utils/utils-user';
14
+
14
15
  @Component({
15
16
  selector: 'chat-bubble-message',
16
17
  templateUrl: './bubble-message.component.html',
@@ -53,7 +54,7 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
53
54
  'hide-delay': 200
54
55
  };
55
56
  sizeImage : { width: number, height: number}
56
-
57
+ fullnameColor: string;
57
58
  public logger: LoggerService = LoggerInstance.getInstance()
58
59
 
59
60
  constructor(
@@ -98,6 +99,14 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
98
99
  if (this.message && this.message.metadata && typeof this.message.metadata === 'object') {
99
100
  this.sizeImage = this.getMetadataSize(this.message.metadata)
100
101
  }
102
+
103
+ if(this.fontColor){
104
+ this.fullnameColor = convertColorToRGBA(this.fontColor, 65)
105
+ }
106
+ if(this.message && this.message.sender_fullname && this.message.sender_fullname.trim() !== ''){
107
+ this.fullnameColor = getColorBck(this.message.sender_fullname)
108
+ console.log('colorrrrrr', this.fullnameColor)
109
+ }
101
110
  }
102
111
 
103
112
 
@@ -257,3 +266,4 @@ export class BubbleMessageComponent implements OnInit, OnChanges {
257
266
 
258
267
 
259
268
  }
269
+
@@ -28,7 +28,7 @@ p {
28
28
  }
29
29
 
30
30
  p ::ng-deep a {
31
- word-break: break-all
31
+ word-break: break-word
32
32
  }
33
33
 
34
34
 
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  </div>
11
11
  <div class="c21-right-conv">
12
- <div class="c21-last-time">{{conversation.time_last_message}}</div>
12
+ <div class="c21-last-time">{{conversation?.timestamp | amTimeAgo}}</div>
13
13
  <div class="truncate c21-name">{{conversation.sender_fullname }}</div>
14
14
  <div *ngIf="conversation.type ==='image'">
15
15
  <div [class.not-read]="conversation.is_new" class="c21-msg" style="float: left; margin-right: 5px;">
@@ -17,7 +17,6 @@
17
17
  width="20px" height="20px" viewBox="0 0 24 24">
18
18
  <path d="M0 0h24v24H0V0z" fill="none"/>
19
19
  <path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
20
- <!-- <title id="altIconTitle">{{ translationMap.get('CLOSED') }}</title> -->
21
20
  </svg>
22
21
  </div>
23
22
  <div [class.not-read]="conversation.is_new" class="truncate c21-msg">{{conversation.last_message_text}}</div>
@@ -14,7 +14,7 @@ import { ConversationModel } from '../../models/conversation';
14
14
 
15
15
  // utils
16
16
  import { avatarPlaceholder, getColorBck } from '../../utils/utils-user';
17
- import { compareValues, getFromNow, searchIndexInArrayForUid, archivedConversationsPathForUserId, isGroup } from '../../utils/utils';
17
+ import { compareValues, searchIndexInArrayForUid, archivedConversationsPathForUserId, isGroup, getTimeLastMessage } from '../../utils/utils';
18
18
  import { ArchivedConversationsHandlerService } from '../abstract/archivedconversations-handler.service';
19
19
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
20
20
  import { LoggerInstance } from '../logger/loggerInstance';
@@ -396,7 +396,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
396
396
  conv.conversation_with = conversation_with;
397
397
  conv.conversation_with_fullname = conversation_with_fullname;
398
398
  conv.status = this.setStatusConversation(conv.sender, conv.uid);
399
- // conv.time_last_message = this.getTimeLastMessage(conv.timestamp); // evaluate if is used
399
+ conv.time_last_message = getTimeLastMessage(conv.timestamp); // evaluate if is used
400
400
  conv.avatar = avatarPlaceholder(conversation_with_fullname);
401
401
  conv.color = getColorBck(conversation_with_fullname);
402
402
  conv.archived = true;
@@ -415,17 +415,6 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
415
415
  return status;
416
416
  }
417
417
 
418
- /**
419
- * calcolo il tempo trascorso da ora al timestamp passato
420
- * @param timestamp
421
- */
422
- private getTimeLastMessage(timestamp: string) {
423
- const timestampNumber = parseInt(timestamp, 10) / 1000;
424
- const time = getFromNow(timestampNumber);
425
- return time;
426
- }
427
-
428
-
429
418
  /**
430
419
  * check if the conversations is valid or not
431
420
  */
@@ -74,7 +74,7 @@ export class FirebaseAuthService extends MessagingAuthService {
74
74
  this.URL_TILEDESK_CREATE_CUSTOM_TOKEN = this.SERVER_BASE_URL + 'chat21/firebase/auth/createCustomToken';
75
75
  this.logger.log('[FIREBASEAuthSERVICE] - initialize URL_TILEDESK_CREATE_CUSTOM_TOKEN ', this.URL_TILEDESK_CREATE_CUSTOM_TOKEN)
76
76
 
77
-
77
+
78
78
  let firebasePersistence;
79
79
  // console.log('FB-AUTH firebasePersistence', this.getPersistence())
80
80
  switch (this.getPersistence()) {
@@ -21,7 +21,7 @@ import { AppConfigProvider } from 'src/app/services/app-config';
21
21
 
22
22
  // utils
23
23
  import { avatarPlaceholder, getColorBck } from '../../utils/utils-user';
24
- import { compareValues, getFromNow, conversationsPathForUserId, searchIndexInArrayForUid, isGroup } from '../../utils/utils';
24
+ import { compareValues, conversationsPathForUserId, searchIndexInArrayForUid, isGroup } from '../../utils/utils';
25
25
  import { TOUCHING_OPERATOR } from '../../utils/constants';
26
26
  import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
27
27
 
@@ -650,16 +650,6 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
650
650
  return status;
651
651
  }
652
652
 
653
- /**
654
- * calcolo il tempo trascorso da ora al timestamp passato
655
- * @param timestamp
656
- */
657
- private getTimeLastMessage(timestamp: string) {
658
- const timestampNumber = parseInt(timestamp, 10) / 1000;
659
- const time = getFromNow(timestampNumber);
660
- return time;
661
- }
662
-
663
653
  /**
664
654
  * check if the conversations is valid or not
665
655
  */
@@ -14,9 +14,6 @@ import { PresenceService } from '../abstract/presence.service';
14
14
  import { CustomLogger } from '../logger/customLogger';
15
15
  import { LoggerInstance } from '../logger/loggerInstance';
16
16
 
17
- // utils
18
- // import { setLastDate } from '../../utils/utils';
19
- // import { environment } from '../../../environments/environment';
20
17
 
21
18
  // @Injectable({providedIn: 'root'})
22
19
  @Injectable()
@@ -13,7 +13,7 @@ import { ConversationsHandlerService } from '../abstract/conversations-handler.s
13
13
  // utils
14
14
  import { TYPE_GROUP } from '../../utils/constants';
15
15
  import { getImageUrlThumbFromFirebasestorage, avatarPlaceholder, getColorBck } from '../../utils/utils-user';
16
- import { compareValues, getFromNow, conversationsPathForUserId, searchIndexInArrayForUid } from '../../utils/utils';
16
+ import { compareValues, conversationsPathForUserId, searchIndexInArrayForUid } from '../../utils/utils';
17
17
  import { ArchivedConversationsHandlerService } from '../abstract/archivedconversations-handler.service';
18
18
  import { LoggerService } from '../abstract/logger.service';
19
19
  import { LoggerInstance } from '../logger/loggerInstance';
@@ -370,39 +370,6 @@ export class MQTTArchivedConversationsHandler extends ArchivedConversationsHandl
370
370
  return status;
371
371
  }
372
372
 
373
- /**
374
- * calcolo il tempo trascorso da ora al timestamp passato
375
- * @param timestamp
376
- */
377
- private getTimeLastMessage(timestamp: string) {
378
- const timestampNumber = parseInt(timestamp) / 1000;
379
- const time = getFromNow(timestampNumber);
380
- return time;
381
- }
382
-
383
- // removeByUid(uid) {
384
- // const index = searchIndexInArrayForUid(this.conversations, uid);
385
- // if (index > -1) {
386
- // this.conversations.splice(index, 1);
387
- // // this.events.publish('conversationsChanged', this.conversations);
388
- // this.conversationsChanged.next(this.conversations);
389
- // }
390
- // }
391
-
392
- // addConversationListener(uidUser, conversationId) {
393
- // var that = this;
394
- // this.tenant = environment.tenant;
395
- // // const tenant = this.chatManager.getTenant();
396
- // const url = '/apps/' + this.tenant + '/users/' + uidUser + '/conversations/' + conversationId;
397
- // const reference = firebase.database().ref(url);
398
- // console.log("ChatConversationsHandler::addConversationListener::reference:",url, reference.toString());
399
- // reference.on('value', function (snapshot) {
400
- // setTimeout(function () {
401
- // // that.events.publish(conversationId + '-listener', snapshot);
402
- // }, 100);
403
- // });
404
- // }
405
-
406
373
  /**
407
374
  * restituisce il numero di conversazioni nuove
408
375
  */
@@ -6,12 +6,6 @@ import { environment } from '../../../environments/environment';
6
6
  import { LoggerService } from '../abstract/logger.service';
7
7
  import { LoggerInstance } from '../logger/loggerInstance';
8
8
 
9
- // // firebase
10
- // import * as firebase from 'firebase/app';
11
- // import 'firebase/messaging';
12
- // import 'firebase/database';
13
- // import 'firebase/auth';
14
-
15
9
  // services
16
10
  // import { EventsService } from '../events-service';
17
11
  import { MessagingAuthService } from '../abstract/messagingAuth.service';
@@ -21,7 +21,6 @@ import {
21
21
  htmlEntities,
22
22
  compareValues,
23
23
  searchIndexInArrayForUid,
24
- setHeaderDate,
25
24
  conversationMessagesRef
26
25
  } from '../../utils/utils';
27
26
  import { isSender, messageType } from '../../utils/utils-message';
@@ -13,7 +13,7 @@ import { ConversationsHandlerService } from '../abstract/conversations-handler.s
13
13
 
14
14
  // utils
15
15
  import { getImageUrlThumbFromFirebasestorage, avatarPlaceholder, getColorBck } from '../../utils/utils-user';
16
- import { compareValues, getFromNow, conversationsPathForUserId, searchIndexInArrayForUid } from '../../utils/utils';
16
+ import { compareValues, conversationsPathForUserId, searchIndexInArrayForUid } from '../../utils/utils';
17
17
  import { LoggerService } from '../abstract/logger.service';
18
18
  import { LoggerInstance } from '../logger/loggerInstance';
19
19
  import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
@@ -383,7 +383,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
383
383
  conv.conversation_with_fullname = conversation_with_fullname;
384
384
  conv.conversation_with = conversation_with;
385
385
  conv.status = this.setStatusConversation(conv.sender, conv.uid);
386
- conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
386
+ // conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
387
387
  conv.avatar = avatarPlaceholder(conversation_with_fullname);
388
388
  conv.color = getColorBck(conversation_with_fullname);
389
389
  if (!conv.last_message_text) {
@@ -417,16 +417,6 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
417
417
  return status;
418
418
  }
419
419
 
420
- /**
421
- * calcolo il tempo trascorso da ora al timestamp passato
422
- * @param timestamp
423
- */
424
- private getTimeLastMessage(timestamp: string) {
425
- const timestampNumber = parseInt(timestamp) / 1000;
426
- const time = getFromNow(timestampNumber);
427
- return time;
428
- }
429
-
430
420
  /**
431
421
  * restituisce il numero di conversazioni nuove
432
422
  */
@@ -12,9 +12,6 @@ import { PresenceService } from '../abstract/presence.service';
12
12
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
13
13
  import { LoggerInstance } from '../logger/loggerInstance';
14
14
 
15
- // utils
16
- import { setLastDate } from '../../utils/utils';
17
- import { environment } from '../../../environments/environment';
18
15
 
19
16
  @Injectable({
20
17
  providedIn: 'root'
@@ -11,8 +11,6 @@ import { PresenceService } from '../abstract/presence.service';
11
11
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
12
12
  import { LoggerInstance } from '../logger/loggerInstance';
13
13
  // utils
14
- import { setLastDate } from '../../utils/utils';
15
- import { environment } from '../../../environments/environment';
16
14
  import { TypingService } from '../abstract/typing.service';
17
15
  import { BehaviorSubject } from 'rxjs';
18
16
 
@@ -67,6 +67,7 @@ export class NativeUploadService extends UploadService {
67
67
  if(upload.file.type.includes('pdf')){
68
68
  downloadURL = this.URL_TILEDESK_FILE + '?path=' + encodeURI(data['filename']);
69
69
  }
70
+ resolve(downloadURL)
70
71
  // that.BSStateUpload.next({upload: upload});
71
72
  }, (error) => {
72
73
  this.logger.error('[NATIVE UPLOAD] - ERROR upload new file ', error)
@@ -180,7 +180,7 @@ export function getProjectIdSelectedConversation(conversationWith: string): stri
180
180
  conversationWith_segments.pop()
181
181
  }
182
182
  let projectId = ''
183
- if (conversationWith_segments.length === 4) {
183
+ if (conversationWith_segments.length >= 4) {
184
184
  projectId = conversationWith_segments[2]
185
185
  }
186
186
  return projectId
@@ -2,9 +2,8 @@
2
2
  import * as moment from 'moment/moment';
3
3
  // import * as moment from 'moment-timezone';
4
4
  import 'moment/locale/it.js';
5
-
6
5
  import { FIREBASESTORAGE_BASE_URL_IMAGE, STORAGE_PREFIX, TYPE_GROUP } from './constants';
7
- import { environment } from '../../environments/environment'; // ?????
6
+
8
7
  import { HttpClient } from '@angular/common/http';
9
8
  import { TranslateHttpLoader } from '@ngx-translate/http-loader';
10
9
  import { AngularDelegate, ModalController } from '@ionic/angular';
@@ -12,7 +11,7 @@ import { ConversationModel } from '../models/conversation';
12
11
 
13
12
  import { MAX_WIDTH_IMAGES, TYPE_DIRECT, TYPE_SUPPORT_GROUP } from './constants';
14
13
 
15
- import { avatarPlaceholder, getColorBck, getImageUrlThumbFromFirebasestorage } from './utils-user';
14
+ import { avatarPlaceholder, getColorBck } from './utils-user';
16
15
  import { TooltipOptions } from 'ng2-tooltip-directive';
17
16
 
18
17
  /**
@@ -148,80 +147,80 @@ export function removeHtmlTags(text) {
148
147
  * ieri;
149
148
  * giorno della settimana (lunedì, martedì, ecc)
150
149
  */
151
- export function setHeaderDate_old(translate, timestamp, lastDate?): string {
152
- var date = new Date(timestamp);
153
- let now: Date = new Date();
154
- var LABEL_TODAY;// = translate.get('LABEL_TODAY')['value'];
155
- var LABEL_TOMORROW;// = translate.get('LABEL_TOMORROW')['value'];
156
- translate.get('LABEL_TODAY').subscribe((res: string) => {
157
- LABEL_TODAY = res;
158
- });
159
- translate.get('LABEL_TOMORROW').subscribe((res: string) => {
160
- LABEL_TOMORROW = res;
161
- });
162
- var labelDays: string = LABEL_TODAY;
163
- var _MS_PER_DAY = 1000 * 60 * 60 * 24;
164
- // Esclude l'ora ed il fuso orario
165
- var utc1 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
166
- var utc2 = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate());
167
- const days = Math.floor((utc2 - utc1) / _MS_PER_DAY);
168
- // console.log('setHeaderDate days: ********************',days);
169
- if (days > 6) {
170
- labelDays = date.toLocaleDateString();//date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
171
- }
172
- else if (days == 0) {
173
- labelDays = LABEL_TODAY;
174
- } else if (days == 1) {
175
- labelDays = LABEL_TOMORROW;
176
- } else {
177
- labelDays = convertDayToString(translate, date.getDay());
178
- }
179
- // console.log('setHeaderDate labelDays: ********************',labelDays);
180
- // se le date sono diverse o la data di riferimento non è impostata
181
- // ritorna la data calcolata
182
- // altrimenti torna null
183
- if (lastDate != labelDays || lastDate == null || lastDate == '') {
184
- return labelDays;
185
- } else {
186
- return null;
187
- }
188
- }
150
+ // export function setHeaderDate_old(translate, timestamp, lastDate?): string {
151
+ // var date = new Date(timestamp);
152
+ // let now: Date = new Date();
153
+ // var LABEL_TODAY;// = translate.get('LABEL_TODAY')['value'];
154
+ // var LABEL_TOMORROW;// = translate.get('LABEL_TOMORROW')['value'];
155
+ // translate.get('LABEL_TODAY').subscribe((res: string) => {
156
+ // LABEL_TODAY = res;
157
+ // });
158
+ // translate.get('LABEL_TOMORROW').subscribe((res: string) => {
159
+ // LABEL_TOMORROW = res;
160
+ // });
161
+ // var labelDays: string = LABEL_TODAY;
162
+ // var _MS_PER_DAY = 1000 * 60 * 60 * 24;
163
+ // // Esclude l'ora ed il fuso orario
164
+ // var utc1 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
165
+ // var utc2 = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate());
166
+ // const days = Math.floor((utc2 - utc1) / _MS_PER_DAY);
167
+ // // console.log('setHeaderDate days: ********************',days);
168
+ // if (days > 6) {
169
+ // labelDays = date.toLocaleDateString();//date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
170
+ // }
171
+ // else if (days == 0) {
172
+ // labelDays = LABEL_TODAY;
173
+ // } else if (days == 1) {
174
+ // labelDays = LABEL_TOMORROW;
175
+ // } else {
176
+ // labelDays = convertDayToString(translate, date.getDay());
177
+ // }
178
+ // // console.log('setHeaderDate labelDays: ********************',labelDays);
179
+ // // se le date sono diverse o la data di riferimento non è impostata
180
+ // // ritorna la data calcolata
181
+ // // altrimenti torna null
182
+ // if (lastDate != labelDays || lastDate == null || lastDate == '') {
183
+ // return labelDays;
184
+ // } else {
185
+ // return null;
186
+ // }
187
+ // }
189
188
 
190
189
  /**
191
190
  * @deprecated
192
191
  */
193
- export function setHeaderDate(translate, timestamp): string {
194
- // const LABEL_TODAY = translate.get('LABEL_TODAY');
195
- // const LABEL_TOMORROW = translate.get('LABEL_TOMORROW');
196
-
197
- const date = new Date(timestamp);
198
- const now: Date = new Date();
199
- let labelDays = '';
200
- if (now.getFullYear() !== date.getFullYear()) {
201
- // quest'anno: data esatta
202
- const month = date.getMonth() + 1;
203
- labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
204
- } else if (now.getMonth() !== date.getMonth()) {
205
- // questo mese: data esatta
206
- const month = date.getMonth() + 1;
207
- labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
208
- } else if (now.getDay() === date.getDay()) {
209
- // oggi: oggi
210
- labelDays = moment().calendar(timestamp).split(' ')[0].toLocaleLowerCase();
211
- // labelDays = LABEL_TODAY;
212
- } else if (now.getDay() - date.getDay() === 1) {
213
- // ieri: ieri
214
- labelDays = moment().calendar(timestamp).split(' ')[0].toLocaleLowerCase();
215
- // labelDays = LABEL_TOMORROW;
216
- } else {
217
- // questa settimana: giorno
218
- labelDays = convertDayToString(translate, date.getDay());
219
- }
220
- // se le date sono diverse o la data di riferimento non è impostata
221
- // ritorna la data calcolata
222
- // altrimenti torna null
223
- return labelDays;
224
- }
192
+ // export function setHeaderDate(translate, timestamp): string {
193
+ // // const LABEL_TODAY = translate.get('LABEL_TODAY');
194
+ // // const LABEL_TOMORROW = translate.get('LABEL_TOMORROW');
195
+
196
+ // const date = new Date(timestamp);
197
+ // const now: Date = new Date();
198
+ // let labelDays = '';
199
+ // if (now.getFullYear() !== date.getFullYear()) {
200
+ // // quest'anno: data esatta
201
+ // const month = date.getMonth() + 1;
202
+ // labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
203
+ // } else if (now.getMonth() !== date.getMonth()) {
204
+ // // questo mese: data esatta
205
+ // const month = date.getMonth() + 1;
206
+ // labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
207
+ // } else if (now.getDay() === date.getDay()) {
208
+ // // oggi: oggi
209
+ // labelDays = moment().calendar(timestamp).split(' ')[0].toLocaleLowerCase();
210
+ // // labelDays = LABEL_TODAY;
211
+ // } else if (now.getDay() - date.getDay() === 1) {
212
+ // // ieri: ieri
213
+ // labelDays = moment().calendar(timestamp).split(' ')[0].toLocaleLowerCase();
214
+ // // labelDays = LABEL_TOMORROW;
215
+ // } else {
216
+ // // questa settimana: giorno
217
+ // labelDays = convertDayToString(translate, date.getDay());
218
+ // }
219
+ // // se le date sono diverse o la data di riferimento non è impostata
220
+ // // ritorna la data calcolata
221
+ // // altrimenti torna null
222
+ // return labelDays;
223
+ // }
225
224
 
226
225
 
227
226
 
@@ -230,33 +229,33 @@ export function setHeaderDate(translate, timestamp): string {
230
229
  * utilizzata per calcolare data ultimo accesso utente
231
230
  * @param timestamp
232
231
  */
233
- export function setLastDate(translate, timestamp): string {
234
-
235
- const LABEL_TODAY = translate.get('LABEL_TODAY');
236
- const LABEL_TOMORROW = translate.get('LABEL_TOMORROW');
237
- const LABEL_TO = translate.get('LABEL_TO');
238
- const LABEL_LAST_ACCESS = translate.get('LABEL_LAST_ACCESS');
239
-
240
- var date = new Date(timestamp);
241
- let now: Date = new Date();
242
- var labelDays = '';
243
- if (now.getFullYear() !== date.getFullYear()) {
244
- const month = date.getMonth() + 1;
245
- labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
246
- } else if (now.getMonth() !== date.getMonth()) {
247
- const month = date.getMonth() + 1;
248
- labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
249
- } else if (now.getDay() === date.getDay()) {
250
- labelDays = LABEL_TODAY;
251
- } else if (now.getDay() - date.getDay() === 1) {
252
- labelDays = LABEL_TOMORROW;
253
- } else {
254
- labelDays = convertDayToString(translate, date.getDay());
255
- }
256
- // aggiungo orario
257
- const orario = date.getHours() + ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
258
- return LABEL_LAST_ACCESS + ' ' + labelDays + ' ' + LABEL_TO + ' ' + orario;
259
- }
232
+ // export function setLastDate(translate, timestamp): string {
233
+
234
+ // const LABEL_TODAY = translate.get('LABEL_TODAY');
235
+ // const LABEL_TOMORROW = translate.get('LABEL_TOMORROW');
236
+ // const LABEL_TO = translate.get('LABEL_TO');
237
+ // const LABEL_LAST_ACCESS = translate.get('LABEL_LAST_ACCESS');
238
+
239
+ // var date = new Date(timestamp);
240
+ // let now: Date = new Date();
241
+ // var labelDays = '';
242
+ // if (now.getFullYear() !== date.getFullYear()) {
243
+ // const month = date.getMonth() + 1;
244
+ // labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
245
+ // } else if (now.getMonth() !== date.getMonth()) {
246
+ // const month = date.getMonth() + 1;
247
+ // labelDays = date.getDay() + '/' + month + '/' + date.getFullYear();
248
+ // } else if (now.getDay() === date.getDay()) {
249
+ // labelDays = LABEL_TODAY;
250
+ // } else if (now.getDay() - date.getDay() === 1) {
251
+ // labelDays = LABEL_TOMORROW;
252
+ // } else {
253
+ // labelDays = convertDayToString(translate, date.getDay());
254
+ // }
255
+ // // aggiungo orario
256
+ // const orario = date.getHours() + ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
257
+ // return LABEL_LAST_ACCESS + ' ' + labelDays + ' ' + LABEL_TO + ' ' + orario;
258
+ // }
260
259
 
261
260
  /**
262
261
  *
@@ -313,16 +312,6 @@ export function supports_html5_session() {
313
312
  }
314
313
  }
315
314
 
316
- export function setStoragePrefix(): string {
317
- let prefix = STORAGE_PREFIX;
318
- try {
319
- prefix = environment.storage_prefix + '_';
320
- } catch (e) {
321
-
322
- }
323
- return prefix + this.g.projectid + '_';
324
- }
325
-
326
315
  // function for dynamic sorting
327
316
  export function compareValues(key, order = 'asc') {
328
317
  return function (a, b) {
@@ -626,20 +615,6 @@ export function setChannelType(conversationWith: string): string {
626
615
  return channelType;
627
616
  }
628
617
 
629
- export function getImageUrlThumb(FIREBASESTORAGE_BASE_URL_IMAGE: string, uid: string) {
630
- let imageurl = FIREBASESTORAGE_BASE_URL_IMAGE + environment['firebaseConfig'].storageBucket + '/o/profiles%2F' + uid + '%2Fthumb_photo.jpg?alt=media';
631
- return imageurl;
632
- }
633
-
634
-
635
- // /** */
636
- // export function getImageUrlThumbFromFirebasestorage(uid: string) {
637
- // const FIREBASESTORAGE_BASE_URL_IMAGE = environment.FIREBASESTORAGE_BASE_URL_IMAGE;
638
- // const urlStorageBucket = environment.firebaseConfig.storageBucket + '/o/profiles%2F';
639
- // const imageurl = FIREBASESTORAGE_BASE_URL_IMAGE + urlStorageBucket + uid + '%2Fthumb_photo.jpg?alt=media';
640
- // return imageurl;
641
- // }
642
-
643
618
 
644
619
  /** */
645
620
  export function bypassSecurityTrustResourceUrl(url: string) {