@chat21/chat21-ionic 3.0.65-rc2 → 3.0.67
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 +22 -0
- package/deploy_amazon_prod.sh +3 -3
- package/package.json +3 -3
- package/src/app/app.component.ts +65 -67
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +0 -10
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +49 -4
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +18 -30
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
- package/src/app/components/ddp-header/ddp-header.component.html +20 -5
- package/src/app/components/ddp-header/ddp-header.component.ts +8 -0
- package/src/app/components/project-item/project-item.component.ts +5 -0
- package/src/app/components/sidebar/sidebar.component.ts +41 -71
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +12 -23
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +3 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +88 -136
- package/src/app/directives/truncate.pipe.ts +0 -1
- package/src/app/pages/authentication/login/login.page.ts +0 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +47 -72
- package/src/app/pages/conversations-list/conversations-list.page.html +3 -1
- package/src/app/pages/conversations-list/conversations-list.page.ts +50 -5
- package/src/app/pages/loader-preview/loader-preview.page.ts +12 -43
- package/src/assets/i18n/ar.json +266 -0
- package/src/assets/i18n/uk.json +266 -0
- package/src/chat-config-pre.json +1 -0
- package/src/chat21-core/providers/abstract/archivedconversations-handler.service.ts +1 -2
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +2 -4
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +29 -25
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -3
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +4 -4
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +66 -60
- package/src/chat21-core/providers/firebase/firebase-groups-handler.ts +5 -5
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -3
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +3 -6
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +3 -3
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +4 -4
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +10 -5
- package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +5 -5
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +3 -2
- package/src/chat21-core/providers/mqtt/mqtt-typing.service.ts +5 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +2 -9
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -1
- package/src/chat21-core/utils/constants.ts +1 -1
- package/src/global.scss +2 -2
- package/deploy_prod.sh +0 -14
|
@@ -320,7 +320,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
320
320
|
const conversations = this.conversationsHandlerService.conversations
|
|
321
321
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
322
322
|
this.conversation_count = conversations.length
|
|
323
|
-
if (conv && conv.sender !== this.loggedUser.uid) {
|
|
323
|
+
if (conv && this.loggedUser && conv.sender !== this.loggedUser.uid) {
|
|
324
324
|
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', conv.sender)
|
|
325
325
|
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
326
326
|
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
|
|
@@ -761,6 +761,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
761
761
|
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
762
762
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
763
763
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
764
|
+
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conversationsHandlerService ', this.conversationWith, conv, this.conv_type)
|
|
764
765
|
if (conv) {
|
|
765
766
|
this.conversationAvatar = setConversationAvatar(
|
|
766
767
|
conv.conversation_with,
|
|
@@ -768,19 +769,45 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
768
769
|
conv.channel_type,
|
|
769
770
|
)
|
|
770
771
|
}
|
|
772
|
+
if(!conv){
|
|
773
|
+
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conv not exist --> search in archived list', this.conversationWith, this.conv_type)
|
|
774
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
775
|
+
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, conv)
|
|
776
|
+
if (conv) {
|
|
777
|
+
console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
778
|
+
this.conversationAvatar = setConversationAvatar(
|
|
779
|
+
conv.conversation_with,
|
|
780
|
+
conv.conversation_with_fullname,
|
|
781
|
+
conv.channel_type,
|
|
782
|
+
)
|
|
783
|
+
}
|
|
784
|
+
})
|
|
785
|
+
}
|
|
771
786
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
772
787
|
})
|
|
773
788
|
} else {
|
|
774
|
-
//get conversation from 'conversations' firebase node
|
|
789
|
+
//get conversation from 'archived-conversations' firebase node
|
|
790
|
+
this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, this.conv_type)
|
|
775
791
|
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
776
792
|
if (conv) {
|
|
777
|
-
// console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
778
793
|
this.conversationAvatar = setConversationAvatar(
|
|
779
794
|
conv.conversation_with,
|
|
780
795
|
conv.conversation_with_fullname,
|
|
781
796
|
conv.channel_type,
|
|
782
797
|
)
|
|
783
798
|
}
|
|
799
|
+
if(!conv){
|
|
800
|
+
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
801
|
+
if (conv) {
|
|
802
|
+
this.conversationAvatar = setConversationAvatar(
|
|
803
|
+
conv.conversation_with,
|
|
804
|
+
conv.conversation_with_fullname,
|
|
805
|
+
conv.channel_type,
|
|
806
|
+
)
|
|
807
|
+
}
|
|
808
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
809
|
+
})
|
|
810
|
+
}
|
|
784
811
|
})
|
|
785
812
|
}
|
|
786
813
|
|
|
@@ -934,7 +961,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
934
961
|
subscriptionKey = 'messageAdded'
|
|
935
962
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
936
963
|
if (!subscription) {
|
|
937
|
-
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
|
|
938
964
|
subscription = this.conversationHandlerService.messageAdded.subscribe((msg: any) => {
|
|
939
965
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
940
966
|
if (msg) {
|
|
@@ -950,7 +976,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
950
976
|
subscriptionKey = 'messageChanged'
|
|
951
977
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
952
978
|
if (!subscription) {
|
|
953
|
-
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged')
|
|
954
979
|
subscription = this.conversationHandlerService.messageChanged.subscribe((msg: any) => {
|
|
955
980
|
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ', msg)
|
|
956
981
|
})
|
|
@@ -961,7 +986,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
961
986
|
subscriptionKey = 'messageRemoved'
|
|
962
987
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
963
988
|
if (!subscription) {
|
|
964
|
-
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
|
|
965
989
|
subscription = this.conversationHandlerService.messageRemoved.subscribe((messageId: any) => {
|
|
966
990
|
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
|
|
967
991
|
})
|
|
@@ -1186,26 +1210,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1186
1210
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts)
|
|
1187
1211
|
|
|
1188
1212
|
if (beforeSlashParts.length === 2) {
|
|
1189
|
-
if (
|
|
1190
|
-
beforeSlashParts[0].indexOf(' ') >= 0 &&
|
|
1191
|
-
afterSlashParts[0] === ''
|
|
1192
|
-
) {
|
|
1213
|
+
if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === '') {
|
|
1193
1214
|
this.HIDE_CANNED_RESPONSES = false
|
|
1194
|
-
this.logger.log(
|
|
1195
|
-
'[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not',
|
|
1196
|
-
)
|
|
1215
|
+
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not')
|
|
1197
1216
|
// if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0].indexOf(' ') >= 0)
|
|
1198
|
-
} else if (
|
|
1199
|
-
beforeSlashParts[0].indexOf(' ') < 0 &&
|
|
1200
|
-
afterSlashParts[0] === ''
|
|
1201
|
-
) {
|
|
1217
|
+
} else if (beforeSlashParts[0].indexOf(' ') < 0 && afterSlashParts[0] === '') {
|
|
1202
1218
|
this.HIDE_CANNED_RESPONSES = true
|
|
1203
1219
|
this.tagsCannedFilter = []
|
|
1204
1220
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not')
|
|
1205
|
-
} else if (
|
|
1206
|
-
beforeSlashParts[0].indexOf(' ') >= 0 &&
|
|
1207
|
-
afterSlashParts[0] === ' '
|
|
1208
|
-
) {
|
|
1221
|
+
} else if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === ' ') {
|
|
1209
1222
|
this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES')
|
|
1210
1223
|
this.HIDE_CANNED_RESPONSES = true
|
|
1211
1224
|
this.tagsCannedFilter = []
|
|
@@ -1475,11 +1488,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1475
1488
|
this.logger.log('[CONVS-DETAIL] - insertAtCursor - myValue ', myValue)
|
|
1476
1489
|
this.logger.log('[CONVS-DETAIL] - insertAtCursor - myField ', myField)
|
|
1477
1490
|
|
|
1478
|
-
// myValue = ' ' + myValue;
|
|
1479
|
-
|
|
1480
|
-
// console.log('[CONVS-DETAIL] - GET TEXT AREA - Here yes myValue ', myValue);
|
|
1481
|
-
// console.log('[CONVS-DETAIL] - GET TEXT AREA - Here yes textArea value length', myField.value.length);
|
|
1482
|
-
|
|
1483
1491
|
if (myField.value.length > 0) {
|
|
1484
1492
|
myValue = ' ' + myValue
|
|
1485
1493
|
}
|
|
@@ -1571,24 +1579,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1571
1579
|
// this.audio.src = '/assets/sounds/pling.mp3';
|
|
1572
1580
|
this.audio.src = URL_SOUND_LIST_CONVERSATION
|
|
1573
1581
|
this.audio.load()
|
|
1574
|
-
this.logger.log(
|
|
1575
|
-
'[CONVS-DETAIL] soundMessage conversation this.audio',
|
|
1576
|
-
this.audio,
|
|
1577
|
-
)
|
|
1582
|
+
this.logger.log('[CONVS-DETAIL] soundMessage conversation this.audio',this.audio)
|
|
1578
1583
|
clearTimeout(this.setTimeoutSound)
|
|
1579
1584
|
this.setTimeoutSound = setTimeout(function () {
|
|
1580
|
-
that.audio
|
|
1581
|
-
.play()
|
|
1582
|
-
.then(() => {
|
|
1585
|
+
that.audio.play().then(() => {
|
|
1583
1586
|
// Audio is playing.
|
|
1584
|
-
this.logger.log(
|
|
1585
|
-
|
|
1586
|
-
that.audio.src,
|
|
1587
|
-
)
|
|
1588
|
-
})
|
|
1589
|
-
.catch((error) => {
|
|
1587
|
+
this.logger.log('[CONVS-DETAIL] soundMessag that.audio.src ',that.audio.src)
|
|
1588
|
+
}).catch((error) => {
|
|
1590
1589
|
that.logger.error(error)
|
|
1591
|
-
|
|
1590
|
+
})
|
|
1592
1591
|
}, 1000)
|
|
1593
1592
|
}
|
|
1594
1593
|
|
|
@@ -1750,10 +1749,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1750
1749
|
* FIREBY BY: click event ScrollToBottom bottom-right icon button
|
|
1751
1750
|
*/
|
|
1752
1751
|
public actionScrollBottom() {
|
|
1753
|
-
this.logger.log(
|
|
1754
|
-
'[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ',
|
|
1755
|
-
this.ionContentChatArea,
|
|
1756
|
-
)
|
|
1752
|
+
this.logger.log('[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ',this.ionContentChatArea)
|
|
1757
1753
|
// const that = this;
|
|
1758
1754
|
this.showButtonToBottom = false
|
|
1759
1755
|
this.updateConversationBadge()
|
|
@@ -1790,43 +1786,22 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1790
1786
|
}
|
|
1791
1787
|
checkAcceptedFile(draggedFileMimeType) {
|
|
1792
1788
|
let isAcceptFile = false
|
|
1793
|
-
this.logger.log(
|
|
1794
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',
|
|
1795
|
-
this.appConfigProvider.getConfig().fileUploadAccept,
|
|
1796
|
-
)
|
|
1789
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ',this.appConfigProvider.getConfig().fileUploadAccept)
|
|
1797
1790
|
const accept_files = this.appConfigProvider.getConfig().fileUploadAccept
|
|
1798
|
-
this.logger.log(
|
|
1799
|
-
'[CONVS-DETAIL] > checkAcceptedFile - mimeType: ',
|
|
1800
|
-
draggedFileMimeType,
|
|
1801
|
-
)
|
|
1791
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ',draggedFileMimeType)
|
|
1802
1792
|
if (accept_files === '*/*') {
|
|
1803
1793
|
isAcceptFile = true
|
|
1804
1794
|
return isAcceptFile
|
|
1805
1795
|
} else if (accept_files !== '*/*') {
|
|
1806
|
-
this.logger.log(
|
|
1807
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept typeof accept_files ',
|
|
1808
|
-
typeof accept_files,
|
|
1809
|
-
)
|
|
1796
|
+
this.logger.log( '[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept typeof accept_files ',typeof accept_files)
|
|
1810
1797
|
const accept_files_array = accept_files.split(',')
|
|
1811
|
-
this.logger.log(
|
|
1812
|
-
|
|
1813
|
-
accept_files_array,
|
|
1814
|
-
)
|
|
1815
|
-
this.logger.log(
|
|
1816
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ',
|
|
1817
|
-
typeof accept_files_array,
|
|
1818
|
-
)
|
|
1798
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array ',accept_files_array)
|
|
1799
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ',typeof accept_files_array)
|
|
1819
1800
|
|
|
1820
1801
|
accept_files_array.forEach((accept_file) => {
|
|
1821
|
-
this.logger.log(
|
|
1822
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ',
|
|
1823
|
-
accept_file,
|
|
1824
|
-
)
|
|
1802
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ',accept_file)
|
|
1825
1803
|
const accept_file_segment = accept_file.split('/')
|
|
1826
|
-
this.logger.log(
|
|
1827
|
-
'[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ',
|
|
1828
|
-
accept_file_segment,
|
|
1829
|
-
)
|
|
1804
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ',accept_file_segment)
|
|
1830
1805
|
if (accept_file_segment[1] === '*') {
|
|
1831
1806
|
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1832
1807
|
isAcceptFile = true
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
[supportMode]="supportMode"
|
|
5
5
|
[archived_btn]="archived_btn"
|
|
6
6
|
[writeto_btn]="writeto_btn"
|
|
7
|
+
[sound_btn]="sound_btn"
|
|
8
|
+
(onSoundChange)="onSoundChange($event)"
|
|
7
9
|
(openContactsDirectory)=openContactsDirectory($event)
|
|
8
10
|
(openProfileInfo)=openProfileInfo($event)>
|
|
9
11
|
</app-ddp-header>
|
|
10
12
|
|
|
11
13
|
<app-option-header *ngIf="conversationType !=='active'"
|
|
12
|
-
|
|
14
|
+
[headerTitle]=headerTitle
|
|
13
15
|
(onBackButton)=onBackButtonFN($event)>
|
|
14
16
|
</app-option-header>
|
|
15
17
|
</ion-header>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
1
2
|
import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
|
|
2
3
|
import { Component, OnInit, ViewChild } from '@angular/core'
|
|
3
4
|
import { IonContent, ModalController } from '@ionic/angular'
|
|
@@ -17,6 +18,8 @@ import {
|
|
|
17
18
|
closeModal,
|
|
18
19
|
convertMessage,
|
|
19
20
|
isGroup,
|
|
21
|
+
searchIndexInArrayForUid,
|
|
22
|
+
compareValues,
|
|
20
23
|
} from '../../../chat21-core/utils/utils'
|
|
21
24
|
|
|
22
25
|
import { EventsService } from '../../services/events-service'
|
|
@@ -69,6 +72,7 @@ export class ConversationListPage implements OnInit {
|
|
|
69
72
|
public supportMode: boolean
|
|
70
73
|
public writeto_btn: boolean
|
|
71
74
|
public archived_btn: boolean
|
|
75
|
+
public sound_btn: string
|
|
72
76
|
public convertMessage = convertMessage
|
|
73
77
|
private isShowMenuPage = false
|
|
74
78
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
@@ -118,11 +122,13 @@ export class ConversationListPage implements OnInit {
|
|
|
118
122
|
public appConfigProvider: AppConfigProvider,
|
|
119
123
|
public platform: Platform,
|
|
120
124
|
private networkService: NetworkService,
|
|
125
|
+
private appStorageService: AppStorageService
|
|
121
126
|
) {
|
|
122
127
|
this.listenToAppCompConvsLengthOnInitConvs()
|
|
123
128
|
this.listenToLogoutEvent()
|
|
124
129
|
this.listenGoOnline()
|
|
125
130
|
this.listenGoOffline()
|
|
131
|
+
this.listenToStorageChange()
|
|
126
132
|
this.listenToSwPostMessage()
|
|
127
133
|
this.listenSupportConvIdHasChanged()
|
|
128
134
|
// this.listenDirectConvIdHasChanged();
|
|
@@ -168,6 +174,7 @@ export class ConversationListPage implements OnInit {
|
|
|
168
174
|
ngOnInit() {
|
|
169
175
|
this.watchToConnectionStatus()
|
|
170
176
|
this.getAppConfigToHideDiplayBtns()
|
|
177
|
+
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
ngOnChanges() {
|
|
@@ -206,6 +213,16 @@ export class ConversationListPage implements OnInit {
|
|
|
206
213
|
this.writeto_btn = false;
|
|
207
214
|
this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
|
|
208
215
|
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
const sound_status = localStorage.getItem('dshbrd----sound')
|
|
219
|
+
if(sound_status && sound_status !== 'undefined'){
|
|
220
|
+
this.sound_btn = sound_status
|
|
221
|
+
} else {
|
|
222
|
+
this.sound_btn = 'enabled'
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
209
226
|
}
|
|
210
227
|
|
|
211
228
|
watchToConnectionStatus() {
|
|
@@ -226,7 +243,7 @@ export class ConversationListPage implements OnInit {
|
|
|
226
243
|
this.logger.log('Called ionViewDidEnter')
|
|
227
244
|
this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',this.uidConvSelected )
|
|
228
245
|
this.listnerStart()
|
|
229
|
-
|
|
246
|
+
// this.conversations = this.manageStoredConversations()
|
|
230
247
|
// exit from app with hardware back button
|
|
231
248
|
this.subscription = this.platform.backButton.subscribe(() => {
|
|
232
249
|
navigator['app'].exitApp()
|
|
@@ -331,10 +348,13 @@ export class ConversationListPage implements OnInit {
|
|
|
331
348
|
})
|
|
332
349
|
}
|
|
333
350
|
|
|
351
|
+
|
|
352
|
+
|
|
334
353
|
// ------------------------------------------------------------------ //
|
|
335
354
|
// Init convrsation handler
|
|
336
355
|
// ------------------------------------------------------------------ //
|
|
337
356
|
initConversationsHandler() {
|
|
357
|
+
// this.conversations = this.manageStoredConversations()
|
|
338
358
|
this.conversations = this.conversationsHandlerService.conversations
|
|
339
359
|
this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations.length, this.conversations)
|
|
340
360
|
// save conversationHandler in chatManager
|
|
@@ -342,6 +362,19 @@ export class ConversationListPage implements OnInit {
|
|
|
342
362
|
this.showPlaceholder = false
|
|
343
363
|
}
|
|
344
364
|
|
|
365
|
+
private manageStoredConversations(): ConversationModel[] {
|
|
366
|
+
let conversationsStored = []
|
|
367
|
+
if(this.appStorageService.getItem('conversations')){
|
|
368
|
+
conversationsStored = JSON.parse(this.appStorageService.getItem('conversations'))
|
|
369
|
+
if(conversationsStored && conversationsStored.length > 0) {
|
|
370
|
+
// this.conversationsHandlerService.conversations = conversationsStored
|
|
371
|
+
this.logger.log('[CONVS-LIST-PAGE] retrive conversations from storage --> ', conversationsStored.length)
|
|
372
|
+
this.events.publish('appcompSubscribeToConvs:loadingIsActive', false);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return conversationsStored
|
|
376
|
+
}
|
|
377
|
+
|
|
345
378
|
initArchivedConversationsHandler() {
|
|
346
379
|
const keysConversation = ['CLOSED', 'Resolve']
|
|
347
380
|
this.translationMapConversation = this.translateService.translateLanguage( keysConversation )
|
|
@@ -416,6 +449,10 @@ export class ConversationListPage implements OnInit {
|
|
|
416
449
|
})
|
|
417
450
|
}
|
|
418
451
|
|
|
452
|
+
listenToStorageChange(){
|
|
453
|
+
this.events.subscribe('storage:sound', value => this.sound_btn = value)
|
|
454
|
+
}
|
|
455
|
+
|
|
419
456
|
// ------------------------------------------------------------------
|
|
420
457
|
// SUBSCRIPTIONS
|
|
421
458
|
// ------------------------------------------------------------------
|
|
@@ -648,16 +685,15 @@ export class ConversationListPage implements OnInit {
|
|
|
648
685
|
let conversationSelected
|
|
649
686
|
if (conversationType === 'active') {
|
|
650
687
|
conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
|
|
651
|
-
this.conversationsHandlerService.uidConvSelected = conversationSelected.uid
|
|
652
688
|
} else if (conversationType === 'archived') {
|
|
653
|
-
conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected)
|
|
654
|
-
this.archivedConversationsHandlerService.uidConvSelected = conversationSelected.uid
|
|
689
|
+
conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected)
|
|
655
690
|
}
|
|
656
691
|
if (conversationSelected) {
|
|
657
692
|
this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected)
|
|
658
693
|
this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded')
|
|
659
694
|
this.conversationSelected = conversationSelected
|
|
660
695
|
this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
|
|
696
|
+
conversationType === 'active'? this.conversationsHandlerService.uidConvSelected = conversationSelected.uid : this.archivedConversationsHandlerService.uidConvSelected = conversationSelected.uid
|
|
661
697
|
}
|
|
662
698
|
}
|
|
663
699
|
}
|
|
@@ -821,6 +857,13 @@ export class ConversationListPage implements OnInit {
|
|
|
821
857
|
}
|
|
822
858
|
}
|
|
823
859
|
|
|
860
|
+
onSoundChange(event: string){
|
|
861
|
+
if(event && event !== undefined){
|
|
862
|
+
localStorage.setItem('dshbrd----sound', event)
|
|
863
|
+
this.sound_btn = event
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
824
867
|
listenToCloseConvFromHeaderConversation() {
|
|
825
868
|
this.events.subscribe('conversation:closed', (convId) => {
|
|
826
869
|
this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation convId', convId)
|
|
@@ -922,7 +965,9 @@ export class ConversationListPage implements OnInit {
|
|
|
922
965
|
this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ',this.conversations)
|
|
923
966
|
this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ',this.conversations.length)
|
|
924
967
|
this.events.publish('conversationhasbeenclosed', conversationId)
|
|
925
|
-
this.
|
|
968
|
+
if(conversationId === this.uidConvSelected){
|
|
969
|
+
this.navigateByUrl('archived', conversationId)
|
|
970
|
+
}
|
|
926
971
|
})
|
|
927
972
|
}
|
|
928
973
|
|
|
@@ -110,39 +110,25 @@ export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
|
110
110
|
} else if (file.type.startsWith('image') && file.type.includes('svg')) {
|
|
111
111
|
// this.previewFiles(file)
|
|
112
112
|
|
|
113
|
-
this.logger.log(
|
|
114
|
-
'[LOADER-PREVIEW-PAGE] - readAsDataURL file TYPE',
|
|
115
|
-
file.type,
|
|
116
|
-
)
|
|
113
|
+
this.logger.log('[LOADER-PREVIEW-PAGE] - readAsDataURL file TYPE',file.type)
|
|
117
114
|
this.logger.log('[LOADER-PREVIEW-PAGE] - readAsDataURL file ', file)
|
|
118
115
|
const preview = document.querySelector('#img-preview') as HTMLImageElement
|
|
119
116
|
|
|
120
117
|
const reader = new FileReader()
|
|
121
118
|
const that = this
|
|
122
|
-
reader.addEventListener(
|
|
123
|
-
'load',
|
|
124
|
-
function () {
|
|
119
|
+
reader.addEventListener('load',function () {
|
|
125
120
|
// convert image file to base64 string
|
|
126
121
|
// const img = reader.result as string;
|
|
127
122
|
const img = reader.result.toString()
|
|
128
|
-
that.logger.log(
|
|
129
|
-
'FIREBASE-UPLOAD USE CASE SVG LoaderPreviewPage readAsDataURL img ',
|
|
130
|
-
img,
|
|
131
|
-
)
|
|
123
|
+
that.logger.log('FIREBASE-UPLOAD USE CASE SVG LoaderPreviewPage readAsDataURL img ',img)
|
|
132
124
|
|
|
133
125
|
// that.fileSelected = that.sanitizer.bypassSecurityTrustResourceUrl(img);
|
|
134
126
|
|
|
135
|
-
that.arrayFiles.push(
|
|
136
|
-
that.sanitizer.bypassSecurityTrustResourceUrl(img),
|
|
137
|
-
)
|
|
127
|
+
that.arrayFiles.push(that.sanitizer.bypassSecurityTrustResourceUrl(img))
|
|
138
128
|
if (!that.fileSelected) {
|
|
139
|
-
that.fileSelected = that.sanitizer.bypassSecurityTrustResourceUrl(
|
|
140
|
-
img,
|
|
141
|
-
)
|
|
129
|
+
that.fileSelected = that.sanitizer.bypassSecurityTrustResourceUrl(img)
|
|
142
130
|
}
|
|
143
|
-
|
|
144
|
-
false,
|
|
145
|
-
)
|
|
131
|
+
},false)
|
|
146
132
|
|
|
147
133
|
if (file) {
|
|
148
134
|
reader.readAsDataURL(file)
|
|
@@ -153,27 +139,13 @@ export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
|
153
139
|
// ---------------------------------------------------------------------
|
|
154
140
|
// } else if (file.type.startsWith("application") || file.type.startsWith("video") || file.type.startsWith("audio") ) {
|
|
155
141
|
} else {
|
|
156
|
-
this.logger.log(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
)
|
|
160
|
-
this.logger.log(
|
|
161
|
-
'[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE TYPE',
|
|
162
|
-
file.type,
|
|
163
|
-
)
|
|
164
|
-
this.file_extension =
|
|
165
|
-
file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length) ||
|
|
166
|
-
file.name
|
|
167
|
-
this.logger.log(
|
|
168
|
-
'[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE EXTENSION',
|
|
169
|
-
this.file_extension,
|
|
170
|
-
)
|
|
142
|
+
this.logger.log('[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE ',file)
|
|
143
|
+
this.logger.log('[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE TYPE',file.type)
|
|
144
|
+
this.file_extension = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length) || file.name
|
|
145
|
+
this.logger.log('[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE EXTENSION',this.file_extension)
|
|
171
146
|
this.file_name = file.name
|
|
172
147
|
this.file_name_ellipsis_the_middle = this.start_and_end(file.name)
|
|
173
|
-
this.logger.log(
|
|
174
|
-
'[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE NAME',
|
|
175
|
-
this.file_name,
|
|
176
|
-
)
|
|
148
|
+
this.logger.log( '[LOADER-PREVIEW-PAGE] - readAsDataURL - USE CASE FILE - FILE NAME',this.file_name)
|
|
177
149
|
// if (file.type) {
|
|
178
150
|
// const file_type_array = file.type.split('/');
|
|
179
151
|
// this.logger.log('FIREBASE-UPLOAD USE CASE FILE LoaderPreviewPage readAsDataURL file_type_array', file_type_array);
|
|
@@ -204,10 +176,7 @@ export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
|
204
176
|
const reader = new FileReader()
|
|
205
177
|
reader.onloadend = (evt) => {
|
|
206
178
|
const img = reader.result.toString()
|
|
207
|
-
this.logger.log(
|
|
208
|
-
'[LOADER-PREVIEW-PAGE] - createFile file - FileReader success img',
|
|
209
|
-
img,
|
|
210
|
-
)
|
|
179
|
+
this.logger.log('[LOADER-PREVIEW-PAGE] - createFile file - FileReader success img',img)
|
|
211
180
|
this.arrayFiles.push(img)
|
|
212
181
|
if (!this.fileSelected) {
|
|
213
182
|
this.fileSelected = img
|