@chat21/chat21-ionic 3.0.103-rc.2 → 3.0.104

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,9 +1,15 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.104 in PROD
4
+ - bug-fixed: messages are lost after chrome close all websocket connections due to inactivity and mqtt not reconnected automatically
5
+
6
+ ### 3.0.103 in PROD
7
+
3
8
  ### 3.0.103-rc.2
4
9
  - added: google signIn for mobile platform
5
10
  - added: FMC and inAppBrowser plugins
6
11
  - minor improvements on canned responses component
12
+ - changed: /email/send with new API
7
13
 
8
14
  ### 3.0.103-rc.1
9
15
  - added: ANGULAR 12
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.103-rc.2",
4
+ "version": "3.0.104",
5
5
  "license": "MIT License",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -109,9 +109,14 @@
109
109
  "cordova-plugin-whitelist": {},
110
110
  "cordova-plugin-statusbar": {},
111
111
  "cordova-plugin-splashscreen": {},
112
- "cordova-plugin-ionic-webview": {},
112
+ "cordova-plugin-ionic-webview": {
113
+ "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
114
+ },
113
115
  "cordova-plugin-ionic-keyboard": {},
114
116
  "cordova-plugin-chooser": {},
117
+ "cordova-android-support-gradle-release": {
118
+ "ANDROID_SUPPORT_VERSION": "27.+"
119
+ },
115
120
  "cordova-plugin-network-information": {},
116
121
  "cordova-plugin-inappbrowser": {},
117
122
  "cordova-plugin-fcm-with-dependecy-updated": {
@@ -139,9 +144,6 @@
139
144
  "DEEPLINK_4_HOST": " ",
140
145
  "DEEPLINK_5_SCHEME": " ",
141
146
  "DEEPLINK_5_HOST": " "
142
- },
143
- "cordova-android-support-gradle-release": {
144
- "ANDROID_SUPPORT_VERSION": "27.+"
145
147
  }
146
148
  },
147
149
  "platforms": [
@@ -129,7 +129,7 @@ export class AppComponent implements OnInit {
129
129
  public webSocketJs: WebSocketJs,
130
130
  public scriptService: ScriptService,
131
131
  public location: Location,
132
- private fcm: FCM
132
+ public fcm: FCM
133
133
  ) {
134
134
 
135
135
  this.saveInStorageNumberOfOpenedChatTab();
@@ -847,7 +847,7 @@ export class AppComponent implements OnInit {
847
847
  }
848
848
  }
849
849
 
850
- private manageTabNotification(sound_type: string, badgeNotificationCount?: number) {
850
+ private manageTabNotification(sound_type: string, canSound: boolean, badgeNotificationCount?: number) {
851
851
  if (!this.isTabVisible) {
852
852
  // TAB IS HIDDEN --> manage title and SOUND
853
853
  let badgeNewConverstionNumber = badgeNotificationCount? badgeNotificationCount : this.conversationsHandlerService.countIsNew()
@@ -870,8 +870,8 @@ export class AppComponent implements OnInit {
870
870
  if(sound_status && sound_status !== 'undefined'){
871
871
  this.isSoundEnabled = sound_status === 'enabled'? true: false
872
872
  }
873
- this.logger.debug('[APP-COMP] manageTabNotification can saund?', this.isInitialized, this.isSoundEnabled, sound_type)
874
- if(this.isInitialized && this.isSoundEnabled) {
873
+ this.logger.debug('[APP-COMP] manageTabNotification can saund?', canSound, this.isSoundEnabled, sound_type)
874
+ if(this.isSoundEnabled && canSound) {
875
875
  switch(sound_type){
876
876
  case 'conv_added': {
877
877
  this.soundConversationAdded();
@@ -997,9 +997,9 @@ export class AppComponent implements OnInit {
997
997
  this.events.subscribe('unservedRequest:count', this.subscribeUnservedRequestCount)
998
998
  this.events.subscribe('convList:onConversationSelected', this.subscribeConversationSelected)
999
999
  this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
1000
- // this.logger.log('[APP-COMP] ***** subscribeConversationAdded *****', conversation);
1000
+ this.logger.log('[APP-COMP] ***** subscribeConversationAdded *****', conversation);
1001
1001
  if (conversation && conversation.is_new === true) {
1002
- this.manageTabNotification('conv_added')
1002
+ this.manageTabNotification('conv_added', conversation.sound)
1003
1003
  }
1004
1004
  if(conversation) this.updateConversationsOnStorage()
1005
1005
  });
@@ -1019,7 +1019,7 @@ export class AppComponent implements OnInit {
1019
1019
  let checkIfStatusChanged = changes.value.is_new === changes.previousValue.is_new? true: false
1020
1020
  let checkIfUidChanged = changes.value.uid === changes.previousValue.uid? true: false
1021
1021
  if(changes.value.is_new && checkIfStatusChanged && checkIfUidChanged){
1022
- this.manageTabNotification('new_message');
1022
+ this.manageTabNotification('new_message', true);
1023
1023
  }
1024
1024
  }
1025
1025
  }
@@ -1195,7 +1195,7 @@ export class AppComponent implements OnInit {
1195
1195
  if (hasClickedLogout === true) {
1196
1196
  this.segmentSignedOut()
1197
1197
  this.appStorageService.removeItem('conversations')
1198
- this.isInitialized = false;
1198
+
1199
1199
  // ----------------------------------------------
1200
1200
  // PUSH NOTIFICATIONS
1201
1201
  // ----------------------------------------------
@@ -1223,7 +1223,7 @@ export class AppComponent implements OnInit {
1223
1223
  if(unservedRequestCount && unservedRequestCount > 0){
1224
1224
  this.logger.debug("subscribeUnservedRequestCount appIsInitialized::::",this.isInitialized)
1225
1225
  if(this.isInitialized){
1226
- this.manageTabNotification('conv_unassigned', unservedRequestCount) //sound and alternate title
1226
+ this.manageTabNotification('conv_unassigned', true, unservedRequestCount) //sound and alternate title
1227
1227
  }
1228
1228
  }
1229
1229
  }
@@ -1284,6 +1284,8 @@ export class AppComponent implements OnInit {
1284
1284
  this.presenceService.removePresence();
1285
1285
  this.tiledeskAuthService.logOut()
1286
1286
  this.messagingAuthService.logout()
1287
+ this.isInitialized = false;
1288
+ this.events.publish('appComp:appIsInitialized', false)
1287
1289
  }
1288
1290
 
1289
1291
  private initConversationsHandler(userId: string) {
@@ -1342,7 +1344,7 @@ export class AppComponent implements OnInit {
1342
1344
  }
1343
1345
 
1344
1346
  private handleNotifications(){
1345
- if(this.platform.is('cordova')){
1347
+ if(!this.platform.is('desktop')){
1346
1348
  this.fcm.onNotification().subscribe(data => {
1347
1349
  let pageUrl = 'conversation-detail/'
1348
1350
  if (data.wasTapped) {
@@ -117,10 +117,10 @@ export class IonConversationDetailComponent extends ConversationContentComponent
117
117
  // console.log('[CONVS-DETAIL] translations: ', labels);
118
118
  // });
119
119
  this.translate.get(['AddAsCannedResponse', 'ViewedPage']).subscribe((text: string) => {
120
- console.log('[CONVS-DETAIL] AddAsCannedResponse translated: ', text);
121
- this.addAsCannedResponseTooltipText = text['AddAsCannedResponse']
122
- this.viewedPageTooltipText = text['ViewedPage']
123
- })
120
+ this.logger.log('[CONVS-DETAIL] AddAsCannedResponse translated: ', text);
121
+ this.addAsCannedResponseTooltipText = text['AddAsCannedResponse']
122
+ this.viewedPageTooltipText = text['ViewedPage']
123
+ })
124
124
  }
125
125
 
126
126
  listenToUploadFileProgress() {
@@ -67,7 +67,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
67
67
  subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
68
68
  if (!subscribtion) {
69
69
  subscribtion = this.presenceService.BSIsOnline.subscribe((data: any) => {
70
- this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
70
+ // this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
71
71
  if (data) {
72
72
  const userId = data.uid;
73
73
  const isOnline = data.isOnline;
@@ -18,7 +18,6 @@ export class SendEmailModal implements OnInit {
18
18
  @Input() enableBackdropDismiss: any
19
19
  @Input() conversationWith: string;
20
20
  @Input() msg: string;
21
- // @Input() email: string;
22
21
  @Input() projectId: string;
23
22
  @Input() translationMap: Map<string, string>;
24
23
  @Output() onSubmitForm = new EventEmitter<{}>();
@@ -72,8 +71,6 @@ export class SendEmailModal implements OnInit {
72
71
  return this.formBuilder.group({
73
72
  subject: ['', [Validators.required]],
74
73
  text: ['', Validators.required],
75
- // to: this.email,
76
- // request_id: this.conversationWith
77
74
  })
78
75
  }
79
76
  async onClose() {
@@ -1244,7 +1244,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1244
1244
  subscription = this.subscriptions.find(item => item.key === subscriptionKey);
1245
1245
  if (!subscription) {
1246
1246
  subscription = this.presenceService.BSIsOnline.subscribe((data: any) => {
1247
- this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
1247
+ // this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
1248
1248
  if (data) {
1249
1249
  const userId = data.uid;
1250
1250
  const isOnline = data.isOnline;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Chat21Client
3
3
 
4
- v0.1.12.6
4
+ v0.1.12.7
5
5
 
6
6
  @Author Andrea Sponziello
7
7
  @Member Gabriele Panico
@@ -24,7 +24,6 @@ class Chat21Client {
24
24
  this.reconnections = 0 // just to check how many reconnections
25
25
  this.client_id = this.uuidv4();
26
26
  this.log = options.log ? true : false;
27
-
28
27
  if (options && options.MQTTendpoint) {
29
28
  if (options.MQTTendpoint.startsWith('/')) {
30
29
  if (this.log) {
@@ -545,7 +544,7 @@ class Chat21Client {
545
544
  if (this.log) {
546
545
  console.log("this.on_message_handler already subscribed. Reconnected num", this.reconnections)
547
546
  }
548
- callbsubscribedCallbackack();
547
+ subscribedCallback();
549
548
  return
550
549
  }
551
550
  this.subscribeToMyConversations(() => {
@@ -999,7 +998,10 @@ class Chat21Client {
999
998
 
1000
999
  this.client.on('connect', // TODO if token is wrong it must reply with an error!
1001
1000
  () => {
1002
- if (this.log) {console.log("Chat client connected. User:" + user_id)}
1001
+ if (this.log) {
1002
+ console.log("Chat client connected. User:" + user_id)
1003
+ console.log("Chat client connected. this.connected:" + this.connected)
1004
+ }
1003
1005
  if (!this.connected) {
1004
1006
  if (this.log) {console.log("Chat client first connection for:" + user_id)}
1005
1007
  this.connected = true
@@ -1026,6 +1028,7 @@ class Chat21Client {
1026
1028
  );
1027
1029
  this.client.on('close',
1028
1030
  () => {
1031
+ this.connected = false
1029
1032
  if (this.log) {console.log("Chat client close event");}
1030
1033
  }
1031
1034
  );
@@ -20,6 +20,7 @@ export class ConversationModel {
20
20
  public color: string,
21
21
  public avatar: string,
22
22
  public archived: boolean,
23
- public type: string
23
+ public type: string,
24
+ public sound: boolean
24
25
  ) { }
25
26
  }
@@ -153,6 +153,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
153
153
  this.logger.debug('[MQTTConversationsHandler] connecting MQTT conversations handler');
154
154
  const handlerConversationAdded = this.chat21Service.chatClient.onConversationAdded( (conv) => {
155
155
  let conversation = this.completeConversation(conv); // needed to get the "conversation_with", and find the conv in the conv-history
156
+ conversation.sound = true
156
157
  this.logger.log("onConversationAdded completed:",conversation);
157
158
  const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
158
159
  if (index > -1) {
@@ -165,6 +166,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
165
166
  }
166
167
  });
167
168
  const handlerConversationUpdated = this.chat21Service.chatClient.onConversationUpdated( (conv, topic) => {
169
+ conv.sound = true;
168
170
  this.logger.debug('[MQTTConversationsHandler] conversation updated:', JSON.stringify(conv));
169
171
  this.changed(conv);
170
172
  });
@@ -187,6 +189,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
187
189
  this.logger.debug('[MQTTConversationsHandler] Last conversations', conversations, 'err', err);
188
190
  if (!err) {
189
191
  conversations.forEach(conv => {
192
+ conv.sound = false;
190
193
  this.added(conv);
191
194
  });
192
195
  loaded();
@@ -45,7 +45,7 @@ export class MQTTPresenceService extends PresenceService {
45
45
  const that = this;
46
46
  let local_BSIsOnline = new BehaviorSubject<any>(null);
47
47
  this.webSocketService.wsRequesterStatus$.subscribe((data: any) => {
48
- this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
48
+ // this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
49
49
  if (data && data.presence && data.presence.status === 'online' ) {
50
50
  that.BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
51
51
  local_BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
@@ -34,7 +34,8 @@ export class ConvertRequestToConversation {
34
34
  getColorBck(request.lead.fullname),
35
35
  avatarPlaceholder(request.lead.fullname),
36
36
  false,
37
- 'text'
37
+ 'text',
38
+ false
38
39
  );
39
40
  }
40
41