@chat21/chat21-ionic 3.0.68 → 3.0.70-rc.1

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 (63) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +6 -657
  3. package/README.md +4 -2
  4. package/config.xml +2 -3
  5. package/package.json +5 -5
  6. package/resources/android/icon/drawable-hdpi-icon.png +0 -0
  7. package/resources/android/icon/drawable-ldpi-icon.png +0 -0
  8. package/resources/android/icon/drawable-mdpi-icon.png +0 -0
  9. package/resources/android/icon/drawable-xhdpi-icon.png +0 -0
  10. package/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
  11. package/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
  12. package/resources/android/icon.png +0 -0
  13. package/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
  14. package/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
  15. package/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
  16. package/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
  17. package/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
  18. package/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  19. package/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
  20. package/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
  21. package/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
  22. package/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
  23. package/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
  24. package/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  25. package/resources/android/splash.png +0 -0
  26. package/resources/android/xml/network_security_config.xml +6 -0
  27. package/resources/ios/icon/icon-1024.png +0 -0
  28. package/resources/ios/icon/icon-108@2x.png +0 -0
  29. package/resources/ios/icon/icon-20.png +0 -0
  30. package/resources/ios/icon/icon-20@2x.png +0 -0
  31. package/resources/ios/icon/icon-20@3x.png +0 -0
  32. package/resources/ios/icon/icon-24@2x.png +0 -0
  33. package/resources/ios/icon/icon-27.5@2x.png +0 -0
  34. package/resources/ios/icon/icon-29.png +0 -0
  35. package/resources/ios/icon/icon-29@2x.png +0 -0
  36. package/resources/ios/icon/icon-29@3x.png +0 -0
  37. package/resources/ios/icon/icon-40.png +0 -0
  38. package/resources/ios/icon/icon-40@2x.png +0 -0
  39. package/resources/ios/icon/icon-40@3x.png +0 -0
  40. package/resources/ios/icon/icon-44@2x.png +0 -0
  41. package/resources/ios/icon/icon-50.png +0 -0
  42. package/resources/ios/icon/icon-50@2x.png +0 -0
  43. package/resources/ios/icon/icon-60.png +0 -0
  44. package/resources/ios/icon/icon-60@2x.png +0 -0
  45. package/resources/ios/icon/icon-60@3x.png +0 -0
  46. package/resources/ios/icon/icon-72.png +0 -0
  47. package/resources/ios/icon/icon-72@2x.png +0 -0
  48. package/resources/ios/icon/icon-76.png +0 -0
  49. package/resources/ios/icon/icon-76@2x.png +0 -0
  50. package/resources/ios/icon/icon-83.5@2x.png +0 -0
  51. package/resources/ios/icon/icon-86@2x.png +0 -0
  52. package/resources/ios/icon/icon-98@2x.png +0 -0
  53. package/resources/ios/icon/icon@2x.png +0 -0
  54. package/resources/ios/icon.png +0 -0
  55. package/resources/ios/splash.jpg +0 -0
  56. package/resources/ios/splash.png +0 -0
  57. package/src/app/app.component.ts +16 -5
  58. package/src/app/components/conversation-info/info-content/info-content.component.ts +19 -19
  59. package/src/app/pages/conversation-detail/conversation-detail.page.ts +22 -22
  60. package/src/app/pages/conversations-list/conversations-list.page.ts +34 -34
  61. package/src/app/pages/create-canned-response/create-canned-response.page.ts +19 -19
  62. package/src/chat-config-native-mqtt.json +3 -3
  63. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +52 -39
@@ -109,6 +109,18 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
109
109
 
110
110
  // }
111
111
 
112
+ getConversationsFromLocalStorage(){
113
+ let conversationsStored = []
114
+ if(localStorage.getItem('chat_sv5__conversations')){
115
+ conversationsStored = JSON.parse(localStorage.getItem('chat_sv5__conversations'))
116
+ if(conversationsStored && conversationsStored.length > 0) {
117
+ // this.conversationsHandlerService.conversations = conversationsStored
118
+ this.logger.log('[FIREBASEConversationsHandlerSERVICE] retrive conversations from storage --> ', conversationsStored.length)
119
+ this.conversations = conversationsStored
120
+ }
121
+ }
122
+ }
123
+
112
124
  /**
113
125
  * mi connetto al nodo conversations
114
126
  * creo la reference
@@ -119,52 +131,53 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
119
131
  //----------------------------------------------------------------------------------
120
132
  subscribeToConversations(lastConversationTimestamp: number, callback) {
121
133
  const that = this;
134
+ this.getConversationsFromLocalStorage()
122
135
  const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId);
123
136
  this.logger.debug('[FIREBASEConversationsHandlerSERVICE] SubscribeToConversations conversations::ACTIVE urlNodeFirebase', urlNodeFirebase)
124
137
  this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
125
138
 
126
- // this.ref.once('value').then(snapshot => {
127
- // if(snapshot && snapshot.val()){
139
+ this.ref.once('value').then(snapshot => {
140
+ this.conversations.splice(0) //empty conversations list and replace storedConversations with remote onces
141
+ if(snapshot && snapshot.val()){
128
142
 
129
-
130
- // snapshot.forEach(childSnapshot => {
131
- // // const childData: ConversationModel = childSnapshot.val();
132
- // // childData.uid = childSnapshot.key
133
- // // that.added(childData)
134
- // // lastConversationTimestamp = childData.timestamp
135
- // that.added(childSnapshot)
136
- // });
137
- // this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of remote conversations on Firebase:', Object.keys(snapshot.val()).length)
138
- // this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of conversation added:', that.conversations)
139
- // callback(that.conversations)
140
- // return lastConversationTimestamp
141
- // }
143
+ snapshot.forEach(childSnapshot => {
144
+ // const childData: ConversationModel = childSnapshot.val();
145
+ // childData.uid = childSnapshot.key
146
+ // that.added(childData)
147
+ // lastConversationTimestamp = childData.timestamp
148
+ that.added(childSnapshot)
149
+ });
150
+ this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of remote conversations on Firebase:', Object.keys(snapshot.val()).length)
151
+ this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of conversation added:', that.conversations)
152
+ callback(that.conversations)
153
+ return lastConversationTimestamp
154
+ }
142
155
 
143
- // }).then(()=> {
144
- // this.ref.on('child_changed', (childSnapshot) => {
145
- // that.changed(childSnapshot);
146
- // });
147
- // this.ref.on('child_removed', (childSnapshot) => {
148
- // that.removed(childSnapshot);
149
- // });
150
- // this.ref.on('child_added', (childSnapshot) => {
151
- // that.added(childSnapshot);
152
- // });
153
- // })
156
+ }).then(()=> {
157
+ this.ref.on('child_changed', (childSnapshot) => {
158
+ that.changed(childSnapshot);
159
+ });
160
+ this.ref.on('child_removed', (childSnapshot) => {
161
+ that.removed(childSnapshot);
162
+ });
163
+ this.ref.on('child_added', (childSnapshot) => {
164
+ that.added(childSnapshot);
165
+ });
166
+ })
154
167
 
155
- this.ref.on('child_changed', (childSnapshot) => {
156
- that.changed(childSnapshot);
157
- });
158
- this.ref.on('child_removed', (childSnapshot) => {
159
- that.removed(childSnapshot);
160
- });
161
- this.ref.on('child_added', (childSnapshot) => {
162
- that.added(childSnapshot);
163
- });
164
-
165
- setTimeout(() => {
166
- callback()
167
- }, 2000);
168
+ // this.ref.on('child_changed', (childSnapshot) => {
169
+ // that.changed(childSnapshot);
170
+ // });
171
+ // this.ref.on('child_removed', (childSnapshot) => {
172
+ // that.removed(childSnapshot);
173
+ // });
174
+ // this.ref.on('child_added', (childSnapshot) => {
175
+ // that.added(childSnapshot);
176
+ // });
177
+
178
+ // setTimeout(() => {
179
+ // callback()
180
+ // }, 2000);
168
181
  }
169
182
 
170
183
  public getLastConversation(callback: (conversation: ConversationModel, error: string)=>void){