@chat21/chat21-ionic 3.4.30-rc1 → 3.4.30-rc3
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 +9 -2
- package/package.json +1 -1
- package/src/app/app.component.ts +4 -0
- package/src/chat21-core/providers/abstract/upload.service.ts +1 -0
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +4 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +43 -34
package/CHANGELOG.md
CHANGED
|
@@ -8,12 +8,19 @@
|
|
|
8
8
|
### **Copyrigth**:
|
|
9
9
|
*Tiledesk SRL*
|
|
10
10
|
|
|
11
|
-
# 3.4.
|
|
12
|
-
- **changed**:
|
|
11
|
+
# 3.4.30-rc3
|
|
12
|
+
- **changed**: when the app is in background, play a sound whenever a new message arrives.
|
|
13
13
|
|
|
14
14
|
# 3.4.29 in PROD
|
|
15
15
|
- **bug-fixed**: web (Chrome >= 144) `ion-content` stopped scrolling on some pages (conversation list / contacts directory / unassigned); removed the forced `--overflow: hidden` and handled scrolling on Ionic’s internal scroll container via `ion-content::part(scroll)`
|
|
16
16
|
|
|
17
|
+
# 3.4.29-rc2
|
|
18
|
+
- **changed**: minor updates on API to upload file/image into chat
|
|
19
|
+
|
|
20
|
+
# 3.4.29-rc1
|
|
21
|
+
- **changed**: API for upload a file/image into chat
|
|
22
|
+
|
|
23
|
+
|
|
17
24
|
# 3.4.28 in PROD
|
|
18
25
|
- **bug-fixed**: cannot do project subscription if last_project object is not a project_user obj
|
|
19
26
|
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -1146,6 +1146,10 @@ export class AppComponent implements OnInit {
|
|
|
1146
1146
|
if (changes.value && changes.value.sender !== currentUser.uid) {
|
|
1147
1147
|
let checkIfStatusChanged = changes.value.is_new === changes.previousValue.is_new? true: false
|
|
1148
1148
|
let checkIfUidChanged = changes.value.uid === changes.previousValue.uid? true: false
|
|
1149
|
+
if(!this.isTabVisible){
|
|
1150
|
+
this.manageTabNotification('new_message', true);
|
|
1151
|
+
return
|
|
1152
|
+
}
|
|
1149
1153
|
if(changes.value.is_new && checkIfStatusChanged && checkIfUidChanged){
|
|
1150
1154
|
this.manageTabNotification('new_message', true);
|
|
1151
1155
|
}
|
|
@@ -41,5 +41,6 @@ export abstract class UploadService {
|
|
|
41
41
|
abstract uploadProfile(userId: string, upload: UploadModel): Promise<any>;
|
|
42
42
|
abstract delete(userId: string, path: string): Promise<any>;
|
|
43
43
|
abstract deleteFile(userId: string, path: string): Promise<any>;
|
|
44
|
+
abstract deleteAsset(userId: string, path: string): Promise<any>
|
|
44
45
|
abstract deleteProfile(userId: string, path: string): Promise<any>
|
|
45
46
|
}
|
|
@@ -323,6 +323,10 @@ export class FirebaseUploadService extends UploadService {
|
|
|
323
323
|
})
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
public async deleteAsset(userId: string, path: string): Promise<any>{
|
|
327
|
+
return this.deleteProfile(userId, path);
|
|
328
|
+
}
|
|
329
|
+
|
|
326
330
|
public async deleteProfile(userId: string, path: string): Promise<any>{
|
|
327
331
|
const that = this;
|
|
328
332
|
const file_name_photo = 'photo.jpg';
|
|
@@ -51,26 +51,32 @@ export class NativeUploadService extends UploadService {
|
|
|
51
51
|
//USE IMAGE API
|
|
52
52
|
const url = this.URL_TILEDESK_UPLOAD + 'images/users'
|
|
53
53
|
return new Promise((resolve, reject) => {
|
|
54
|
-
that.http.post(url, formData, requestOptions).subscribe(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
that.http.post(url, formData, requestOptions).pipe(first()).subscribe({
|
|
55
|
+
next: (data) => {
|
|
56
|
+
const downloadURL = this.URL_TILEDESK_UPLOAD + 'images?path=' + encodeURIComponent(data?.['filename']);
|
|
57
|
+
resolve({downloadURL : downloadURL, src: downloadURL})
|
|
58
|
+
// that.BSStateUpload.next({upload: upload});
|
|
59
|
+
},
|
|
60
|
+
error: (error) => {
|
|
61
|
+
reject(error)
|
|
62
|
+
}
|
|
60
63
|
});
|
|
61
64
|
});
|
|
62
65
|
} else {
|
|
63
66
|
//USE FILE API
|
|
64
67
|
const url = this.URL_TILEDESK_UPLOAD + 'files/users'
|
|
65
68
|
return new Promise((resolve, reject) => {
|
|
66
|
-
that.http.post(url, formData, requestOptions).subscribe(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
that.http.post(url, formData, requestOptions).pipe(first()).subscribe({
|
|
70
|
+
next: (data) => {
|
|
71
|
+
const src = this.URL_TILEDESK_UPLOAD + 'files?path=' + encodeURIComponent(data['filename']);
|
|
72
|
+
const downloadURL = this.URL_TILEDESK_UPLOAD + 'files/download' + '?path=' + encodeURIComponent(data['filename']);
|
|
73
|
+
resolve({downloadURL : downloadURL, src: src})
|
|
74
|
+
// that.BSStateUpload.next({upload: upload});
|
|
75
|
+
},
|
|
76
|
+
error: (error) => {
|
|
77
|
+
this.logger.error('[NATIVE UPLOAD] - ERROR upload new file ', error)
|
|
78
|
+
reject(error)
|
|
79
|
+
}
|
|
74
80
|
});
|
|
75
81
|
});
|
|
76
82
|
}
|
|
@@ -92,8 +98,9 @@ export class NativeUploadService extends UploadService {
|
|
|
92
98
|
return new Promise((resolve, reject) => {
|
|
93
99
|
that.http.post(url, formData, requestOptions).pipe(first()).subscribe({
|
|
94
100
|
next: (data) => {
|
|
95
|
-
const
|
|
96
|
-
|
|
101
|
+
const src = this.URL_TILEDESK_UPLOAD + 'files?path=' + encodeURIComponent(data['filename']);
|
|
102
|
+
const downloadURL = this.URL_TILEDESK_UPLOAD + 'files/download?path=' + encodeURIComponent(data['filename']);
|
|
103
|
+
resolve({downloadURL : downloadURL, src: src})
|
|
97
104
|
},
|
|
98
105
|
error: (error) => {
|
|
99
106
|
reject(error)
|
|
@@ -112,19 +119,14 @@ export class NativeUploadService extends UploadService {
|
|
|
112
119
|
formData.append('file', upload.file);
|
|
113
120
|
|
|
114
121
|
const that = this;
|
|
115
|
-
const
|
|
122
|
+
const queryString = expiration !== undefined ? `?expiration=${encodeURIComponent(String(expiration))}` : ''
|
|
123
|
+
const url = this.URL_TILEDESK_FILE + `/assets${queryString}`
|
|
116
124
|
return new Promise((resolve, reject) => {
|
|
117
125
|
that.http.post(url, formData, requestOptions).pipe(first()).subscribe({
|
|
118
126
|
next: (data) => {
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const downloadURL = directUrl || (filenameOrPath ? (this.getBaseUrl() + 'files' + '?path=' + encodeURIComponent(filenameOrPath)) : null);
|
|
123
|
-
if (!downloadURL) {
|
|
124
|
-
reject(new Error('[NATIVE UPLOAD] uploadAsset: unexpected response payload'))
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
resolve({ downloadURL: downloadURL, src: downloadURL })
|
|
127
|
+
const src = this.URL_TILEDESK_UPLOAD + 'files?path=' + data['filename'];
|
|
128
|
+
const downloadURL = this.URL_TILEDESK_UPLOAD + 'files/download?path=' + encodeURIComponent(data['filename']);
|
|
129
|
+
resolve({downloadURL : downloadURL, src: src})
|
|
128
130
|
},
|
|
129
131
|
error: (error) => {
|
|
130
132
|
reject(error)
|
|
@@ -145,8 +147,8 @@ export class NativeUploadService extends UploadService {
|
|
|
145
147
|
|
|
146
148
|
// USE IMAGE API
|
|
147
149
|
const that = this;
|
|
148
|
-
const
|
|
149
|
-
const url = this.URL_TILEDESK_FILE + `/users/photo
|
|
150
|
+
const queryString = userId?.startsWith('bot_') ? `?bot_id=${encodeURIComponent(userId.substring('bot_'.length))}` : ''
|
|
151
|
+
const url = this.URL_TILEDESK_FILE + `/users/photo${queryString}`
|
|
150
152
|
return new Promise((resolve, reject) => {
|
|
151
153
|
that.http.put(url, formData, requestOptions).pipe(first()).subscribe({
|
|
152
154
|
next: (data) => {
|
|
@@ -173,12 +175,15 @@ export class NativeUploadService extends UploadService {
|
|
|
173
175
|
const that = this;
|
|
174
176
|
const url = this.URL_TILEDESK_UPLOAD + 'images/users' + '?path=' + path.split('path=')[1]
|
|
175
177
|
return new Promise((resolve, reject) => {
|
|
176
|
-
that.http.delete(url, requestOptions).subscribe(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
that.http.delete(url, requestOptions).pipe(first()).subscribe({
|
|
179
|
+
next: (data) => {
|
|
180
|
+
// const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['filename'];
|
|
181
|
+
resolve(true)
|
|
182
|
+
// that.BSStateUpload.next({upload: upload});
|
|
183
|
+
},
|
|
184
|
+
error: (error) => {
|
|
185
|
+
reject(error)
|
|
186
|
+
}
|
|
182
187
|
});
|
|
183
188
|
});
|
|
184
189
|
}
|
|
@@ -208,6 +213,10 @@ export class NativeUploadService extends UploadService {
|
|
|
208
213
|
});
|
|
209
214
|
}
|
|
210
215
|
|
|
216
|
+
deleteAsset(userId: string, path: string): Promise<any>{
|
|
217
|
+
return this.deleteFile(userId, path);
|
|
218
|
+
}
|
|
219
|
+
|
|
211
220
|
deleteProfile(userId: string, path: string): Promise<any>{
|
|
212
221
|
this.logger.log('[NATIVE UPLOAD] - delete image ... upload', userId)
|
|
213
222
|
const headers = new HttpHeaders({
|