@chat21/chat21-ionic 3.0.107-rc.1 → 3.0.107-rc.2
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
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.107.rc.2
|
|
4
|
+
- added: moved eventTrigger method from conversation-deatil and conversation-list pages to app.component.ts
|
|
5
|
+
|
|
3
6
|
### 3.0.107.rc.1
|
|
4
7
|
- added: globals and globals-settings services to manage env and option variables globally
|
|
5
8
|
- added: eventTrigger service to expose custom chat event to parent chat-iframe container
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Subscription } from 'rxjs';
|
|
|
8
8
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
9
9
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
10
10
|
import { WebSocketJs } from './services/websocket/websocket-js';
|
|
11
|
-
import { checkPlatformIsMobile, getParameterByName, isOnMobileDevice } from 'src/chat21-core/utils/utils';
|
|
11
|
+
import { checkPlatformIsMobile, getDateDifference, getParameterByName, isOnMobileDevice } from 'src/chat21-core/utils/utils';
|
|
12
12
|
import { EventsService } from './services/events-service';
|
|
13
13
|
import { NavProxyService } from './services/nav-proxy.service';
|
|
14
14
|
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
@@ -40,6 +40,7 @@ import { Deeplinks } from '@ionic-native/deeplinks/ngx';
|
|
|
40
40
|
import { TriggerEvents } from './services/triggerEvents/triggerEvents';
|
|
41
41
|
import { Globals } from './utils/globals';
|
|
42
42
|
import { GlobalSettingsService } from './services/global-settings/global-settings.service';
|
|
43
|
+
import { commandToMessage, conversationToMessage, isSender } from 'src/chat21-core/utils/utils-message';
|
|
43
44
|
|
|
44
45
|
@Component({
|
|
45
46
|
selector: 'app-root',
|
|
@@ -738,7 +739,7 @@ export class AppComponent implements OnInit {
|
|
|
738
739
|
}
|
|
739
740
|
}, 1000)
|
|
740
741
|
}else{
|
|
741
|
-
this.goToDashboardLogin()
|
|
742
|
+
// this.goToDashboardLogin()
|
|
742
743
|
}
|
|
743
744
|
}
|
|
744
745
|
}
|
|
@@ -1006,8 +1007,9 @@ export class AppComponent implements OnInit {
|
|
|
1006
1007
|
this.events.subscribe('convList:onConversationSelected', this.subscribeConversationSelected)
|
|
1007
1008
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
1008
1009
|
this.logger.log('[APP-COMP] ***** subscribeConversationAdded *****', conversation);
|
|
1009
|
-
if (conversation && conversation.is_new === true) {
|
|
1010
|
+
if (conversation && conversation.is_new === true && this.isInitialized) {
|
|
1010
1011
|
this.manageTabNotification('conv_added', conversation.sound)
|
|
1012
|
+
this.manageEventNewConversation(conversation)
|
|
1011
1013
|
}
|
|
1012
1014
|
if(conversation) this.updateConversationsOnStorage()
|
|
1013
1015
|
});
|
|
@@ -1015,7 +1017,6 @@ export class AppComponent implements OnInit {
|
|
|
1015
1017
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
1016
1018
|
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
1017
1019
|
if(conversation) this.updateConversationsOnStorage();
|
|
1018
|
-
const currentUser = this.tiledeskAuthService.getCurrentUser()
|
|
1019
1020
|
});
|
|
1020
1021
|
|
|
1021
1022
|
this.conversationsHandlerService.conversationChangedDetailed.subscribe((changes: {value: ConversationModel, previousValue: ConversationModel}) => {
|
|
@@ -1030,6 +1031,7 @@ export class AppComponent implements OnInit {
|
|
|
1030
1031
|
this.manageTabNotification('new_message', true);
|
|
1031
1032
|
}
|
|
1032
1033
|
}
|
|
1034
|
+
this.manageEventNewMessage(changes.value)
|
|
1033
1035
|
}
|
|
1034
1036
|
});
|
|
1035
1037
|
|
|
@@ -1512,6 +1514,23 @@ export class AppComponent implements OnInit {
|
|
|
1512
1514
|
}
|
|
1513
1515
|
|
|
1514
1516
|
|
|
1517
|
+
private manageEventNewMessage(conversation: ConversationModel){
|
|
1518
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
1519
|
+
let message = conversationToMessage(conversation, currentUser.uid)
|
|
1520
|
+
let duration = getDateDifference(message.timestamp, Date.now())
|
|
1521
|
+
if(duration.minutes > 1) return;
|
|
1522
|
+
if(message.isSender){
|
|
1523
|
+
this.triggerEvents.triggerAfterSendMessageEvent(message)
|
|
1524
|
+
}else if(!message.isSender){
|
|
1525
|
+
this.triggerEvents.triggerAfterMessageReceived(message)
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
private manageEventNewConversation(conversation){
|
|
1530
|
+
this.triggerEvents.triggerOnNewConversationInit(conversation)
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
|
|
1515
1534
|
@HostListener('document:visibilitychange', [])
|
|
1516
1535
|
visibilitychange() {
|
|
1517
1536
|
// this.logger.debug("document TITLE", document.hidden, document.title);
|
|
@@ -243,7 +243,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
243
243
|
private webSocketService: WebsocketService,
|
|
244
244
|
private sanitizer: DomSanitizer,
|
|
245
245
|
private g: Globals,
|
|
246
|
-
private triggerEvents: TriggerEvents
|
|
247
246
|
) {
|
|
248
247
|
// Change list on date change
|
|
249
248
|
this.route.paramMap.subscribe((params) => {
|
|
@@ -1180,7 +1179,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1180
1179
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
1181
1180
|
if (msg) {
|
|
1182
1181
|
that.newMessageAdded(msg)
|
|
1183
|
-
that.manageEvent(msg)
|
|
1184
1182
|
// this.setHeaderContent()
|
|
1185
1183
|
}
|
|
1186
1184
|
})
|
|
@@ -1336,14 +1334,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1336
1334
|
}
|
|
1337
1335
|
}
|
|
1338
1336
|
|
|
1339
|
-
manageEvent(msg: MessageModel){
|
|
1340
|
-
if(msg.isSender){
|
|
1341
|
-
this.triggerEvents.triggerAfterSendMessageEvent(msg)
|
|
1342
|
-
}else if(!msg.isSender){
|
|
1343
|
-
this.triggerEvents.triggerAfterMessageReceived(msg)
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
1337
|
// ----------------------------------------------------------------
|
|
1348
1338
|
// @ Unsubscribe all subscribed events (called in ionViewWillLeave)
|
|
1349
1339
|
// ----------------------------------------------------------------
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
convertMessage,
|
|
20
20
|
isGroup,
|
|
21
21
|
getParameterValue,
|
|
22
|
+
getDateDifference,
|
|
22
23
|
} from '../../../chat21-core/utils/utils'
|
|
23
24
|
|
|
24
25
|
import { EventsService } from '../../services/events-service'
|
|
@@ -50,6 +51,7 @@ import { getProjectIdSelectedConversation } from 'src/chat21-core/utils/utils-me
|
|
|
50
51
|
import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
51
52
|
import { Globals } from 'src/app/utils/globals';
|
|
52
53
|
import { TriggerEvents } from 'src/app/services/triggerEvents/triggerEvents';
|
|
54
|
+
import { MessageModel } from 'src/chat21-core/models/message';
|
|
53
55
|
|
|
54
56
|
@Component({
|
|
55
57
|
selector: 'app-conversations-list',
|
|
@@ -129,7 +131,6 @@ export class ConversationListPage implements OnInit {
|
|
|
129
131
|
public platform: Platform,
|
|
130
132
|
public wsService: WebsocketService,
|
|
131
133
|
private g: Globals,
|
|
132
|
-
private triggerEvents: TriggerEvents
|
|
133
134
|
) {
|
|
134
135
|
this.checkPlatform();
|
|
135
136
|
this.translations();
|
|
@@ -572,7 +573,6 @@ export class ConversationListPage implements OnInit {
|
|
|
572
573
|
if (conversation) {
|
|
573
574
|
this.onImageLoaded(conversation)
|
|
574
575
|
this.onConversationLoaded(conversation)
|
|
575
|
-
conversation.is_new && this.isInitialized? this.manageEvent(conversation) : null
|
|
576
576
|
// conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
|
|
577
577
|
}
|
|
578
578
|
})
|
|
@@ -647,10 +647,6 @@ export class ConversationListPage implements OnInit {
|
|
|
647
647
|
// }
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
manageEvent(conversation){
|
|
651
|
-
this.triggerEvents.triggerOnNewConversationInit(conversation)
|
|
652
|
-
}
|
|
653
|
-
|
|
654
650
|
// ------------------------------------------------------------------//
|
|
655
651
|
// END SUBSCRIPTIONS
|
|
656
652
|
// ------------------------------------------------------------------//
|