@chat21/chat21-ionic 3.0.104 → 3.0.105
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 +8 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +8 -5
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +3 -3
- package/src/app/components/authentication/login/login.component.ts +1 -1
- package/src/app/modals/loader-preview/loader-preview.page.ts +2 -0
- package/src/app/pages/authentication/login/login.page.ts +1 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +15 -14
- package/src/app/pages/conversations-list/conversations-list.page.ts +1 -103
- package/src/chat21-core/providers/abstract/upload.service.ts +1 -0
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +39 -0
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +5 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.105 in PROD
|
|
4
|
+
|
|
5
|
+
### 3.0.105.rc.1
|
|
6
|
+
- added: get tiledeskToken from tiledesk_token key in favour of appStorageService.getItem('tiledeskToken')
|
|
7
|
+
|
|
8
|
+
### 3.0.104.1 in PROD
|
|
9
|
+
- minor bug fixing
|
|
10
|
+
|
|
3
11
|
### 3.0.104 in PROD
|
|
4
12
|
- bug-fixed: messages are lost after chrome close all websocket connections due to inactivity and mqtt not reconnected automatically
|
|
5
13
|
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -281,11 +281,11 @@ export class AppComponent implements OnInit {
|
|
|
281
281
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName ', token)
|
|
282
282
|
// save token in local storage then
|
|
283
283
|
|
|
284
|
-
const storedToken =
|
|
284
|
+
const storedToken = localStorage.getItem('tiledesk_token')
|
|
285
285
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN storedToken ', storedToken)
|
|
286
286
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN SAVE THE PARAMS TOKEN ', token)
|
|
287
287
|
if (storedToken !== token) {
|
|
288
|
-
|
|
288
|
+
localStorage.setItem('tiledesk_token', token)
|
|
289
289
|
} else {
|
|
290
290
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
|
|
291
291
|
}
|
|
@@ -506,7 +506,7 @@ export class AppComponent implements OnInit {
|
|
|
506
506
|
this.deeplinks.route({'/conversation-detail': ConversationListPage}).subscribe(match => {
|
|
507
507
|
this.logger.log('[APP-COMP] deeplinks match route', JSON.stringify(match.$args))
|
|
508
508
|
if(match.$args && match.$args.jwt){
|
|
509
|
-
|
|
509
|
+
localStorage.setItem('tiledesk_token', decodeURIComponent(match.$args.jwt))
|
|
510
510
|
this.initAuthentication()
|
|
511
511
|
}
|
|
512
512
|
}, (nomatch)=> {
|
|
@@ -697,7 +697,7 @@ export class AppComponent implements OnInit {
|
|
|
697
697
|
/***************************************************+*/
|
|
698
698
|
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
699
699
|
private initAuthentication() {
|
|
700
|
-
const tiledeskToken =
|
|
700
|
+
const tiledeskToken = localStorage.getItem('tiledesk_token')
|
|
701
701
|
|
|
702
702
|
this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
|
|
703
703
|
this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
|
|
@@ -1381,10 +1381,13 @@ export class AppComponent implements OnInit {
|
|
|
1381
1381
|
}
|
|
1382
1382
|
|
|
1383
1383
|
private segmentSignIn(){
|
|
1384
|
+
const that = this
|
|
1384
1385
|
let user = this.tiledeskAuthService.getCurrentUser()
|
|
1385
1386
|
if(window['analytics']){
|
|
1386
1387
|
try {
|
|
1387
|
-
window['analytics'].page("Chat Auth Page, Signin", {
|
|
1388
|
+
window['analytics'].page("Chat Auth Page, Signin", {
|
|
1389
|
+
version: that.version
|
|
1390
|
+
});
|
|
1388
1391
|
} catch (err) {
|
|
1389
1392
|
this.logger.error('Event:Signed In [page] error', err);
|
|
1390
1393
|
}
|
|
@@ -160,13 +160,13 @@
|
|
|
160
160
|
</ion-note>
|
|
161
161
|
|
|
162
162
|
<ion-buttons slot="end">
|
|
163
|
-
<ion-button *ngIf="!conversation.archived"
|
|
163
|
+
<ion-button *ngIf="!conversation.archived" placement="bottom"
|
|
164
164
|
[ngClass]="{'hide': !isApp, 'button-on-desktop': !isApp, 'button-on-mobile': isApp }"
|
|
165
165
|
id="{{ 'close_conversation_button' + conversation.uid }}" class="close-conversation-button" ion-button clear
|
|
166
166
|
item-end (click)="closeConversation(conversation);$event.stopPropagation();" padding>
|
|
167
167
|
<ion-icon slot="icon-only" style="display:block;" id="{{ 'close_button_icon' + conversation.uid }}" name="archive-outline" item-end></ion-icon>
|
|
168
|
-
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
|
|
169
|
-
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div>
|
|
168
|
+
<!-- <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
|
|
169
|
+
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div> -->
|
|
170
170
|
</ion-button>
|
|
171
171
|
|
|
172
172
|
<!-- <ion-button *ngIf="conversation?.recipient.startsWith('support-group') && !conversation.archived" [tooltip]="joinTooltip" [options]="tooltip_options" placement="bottom" content-type="template"
|
|
@@ -137,7 +137,7 @@ export class LoginComponent implements OnInit {
|
|
|
137
137
|
signInWithGoogle(){
|
|
138
138
|
// const url = this.SERVER_BASE_PATH + "auth/google"
|
|
139
139
|
const url = "https://eu.rtmv3.tiledesk.com/api/auth/google" + '?forced_redirect_url=chat://conversation-detail?from=google'
|
|
140
|
-
this.iab.create(url, '_system', '
|
|
140
|
+
this.iab.create(url, '_system', 'location=yes')
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/** */
|
|
@@ -338,6 +338,7 @@ export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
|
338
338
|
const file4Load = new Image()
|
|
339
339
|
const nameImg = file.name
|
|
340
340
|
const typeFile = file.type
|
|
341
|
+
const size = file.size
|
|
341
342
|
|
|
342
343
|
file4Load.src = this.fileSelected
|
|
343
344
|
file4Load.title = nameImg
|
|
@@ -349,6 +350,7 @@ export class LoaderPreviewPage implements OnInit, AfterViewInit {
|
|
|
349
350
|
height: file4Load.height,
|
|
350
351
|
type: typeFile,
|
|
351
352
|
uid: uid,
|
|
353
|
+
size: size
|
|
352
354
|
}
|
|
353
355
|
this.viewCtrl.dismiss({
|
|
354
356
|
fileSelected: file,
|
|
@@ -124,6 +124,7 @@ export class LoginPage implements OnInit {
|
|
|
124
124
|
this.tiledeskAuthService.signInWithEmailAndPassword(auth.email, auth.password)
|
|
125
125
|
.then(tiledeskToken => {
|
|
126
126
|
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
127
|
+
localStorage.setItem('tiledesk_token', tiledeskToken)
|
|
127
128
|
// Here edit stored current user
|
|
128
129
|
// this.updateStoredCurrentUser()
|
|
129
130
|
})
|
|
@@ -325,10 +325,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
325
325
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
326
326
|
this.conversation_count = conversations.length
|
|
327
327
|
if (conv && this.loggedUser && conv.sender !== this.loggedUser.uid) {
|
|
328
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange
|
|
328
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange ', conv)
|
|
329
329
|
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
330
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
|
|
331
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
332
330
|
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
333
331
|
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
334
332
|
// if (!this.showButtonToBottom && conv.is_new) {
|
|
@@ -748,15 +746,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
748
746
|
// .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
|
|
749
747
|
// .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
|
|
750
748
|
this.styleMap.set('themeColor', '#2a69c1')
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
749
|
+
.set('bubbleReceivedBackground', '#f0f2f7')
|
|
750
|
+
.set('bubbleReceivedTextColor', '#06132b')
|
|
751
|
+
.set('bubbleSentBackground', '#2a6ac1')
|
|
752
|
+
.set('bubbleSentTextColor', '#ffffff')
|
|
753
|
+
.set('buttonFontSize', '15px')
|
|
754
|
+
.set('buttonBackgroundColor', '#ffffff')
|
|
755
|
+
.set('buttonTextColor', '#2a6ac1')
|
|
756
|
+
.set('buttonHoverBackgroundColor', '#2a6ac1')
|
|
757
|
+
.set('buttonHoverTextColor', ' #ffffff')
|
|
760
758
|
|
|
761
759
|
}
|
|
762
760
|
// -------------------------------------------------------------------------------------
|
|
@@ -1116,14 +1114,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1116
1114
|
|
|
1117
1115
|
|
|
1118
1116
|
const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
|
|
1119
|
-
const
|
|
1117
|
+
const channelIsNotEmailOrFormOrWhatsappOrTelegram = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL ||
|
|
1118
|
+
attributes['request_channel'] === TYPE_MSG_FORM ||
|
|
1119
|
+
attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP ||
|
|
1120
|
+
attributes['request_channel'] === CHANNEL_TYPE_TELEGRAM))
|
|
1120
1121
|
|
|
1121
1122
|
if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
|
|
1122
1123
|
|
|
1123
1124
|
|
|
1124
1125
|
if (this.isEmailEnabled &&
|
|
1125
1126
|
this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status'] === 'offline' &&
|
|
1126
|
-
this.leadInfo.email && !emailSectionMsg && !
|
|
1127
|
+
this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsappOrTelegram) {
|
|
1127
1128
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1128
1129
|
let msgText = this.createEmailText(msg)
|
|
1129
1130
|
this.sendEmail(msgText).subscribe(status => {
|
|
@@ -583,7 +583,7 @@ export class ConversationListPage implements OnInit {
|
|
|
583
583
|
if (conversation) {
|
|
584
584
|
this.onImageLoaded(conversation)
|
|
585
585
|
this.onConversationLoaded(conversation)
|
|
586
|
-
conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
|
|
586
|
+
// conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
|
|
587
587
|
}
|
|
588
588
|
})
|
|
589
589
|
|
|
@@ -852,9 +852,6 @@ export class ConversationListPage implements OnInit {
|
|
|
852
852
|
conversation.attributes.project_name = project['name']
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
// if(conversation.conversation_with_fullname === 'Guest '){
|
|
856
|
-
// conversation.conversation_with_fullname = 'guest' + '#' + this.getUUidConversation(conversation.uid)
|
|
857
|
-
// }
|
|
858
855
|
|
|
859
856
|
}
|
|
860
857
|
|
|
@@ -1142,103 +1139,4 @@ export class ConversationListPage implements OnInit {
|
|
|
1142
1139
|
}
|
|
1143
1140
|
}
|
|
1144
1141
|
|
|
1145
|
-
// ------------------------------------------------------------------
|
|
1146
|
-
// !!! Not used methods !!!
|
|
1147
|
-
// ------------------------------------------------------------------
|
|
1148
|
-
|
|
1149
|
-
// /**
|
|
1150
|
-
// * ::: openArchivedConversationsPage :::
|
|
1151
|
-
// * Open the archived conversations page
|
|
1152
|
-
// * (metodo richiamato da html)
|
|
1153
|
-
// */
|
|
1154
|
-
// openArchivedConversationsPage() {
|
|
1155
|
-
// this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
|
|
1156
|
-
// }
|
|
1157
|
-
|
|
1158
|
-
// // info page
|
|
1159
|
-
// returnCloseInfoPage() {
|
|
1160
|
-
// this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
|
|
1161
|
-
// // this.isShowMenuPage = false;
|
|
1162
|
-
// this.initialize();
|
|
1163
|
-
|
|
1164
|
-
// }
|
|
1165
|
-
|
|
1166
|
-
// private navigatePage() {
|
|
1167
|
-
// this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
|
|
1168
|
-
// let urlPage = 'detail/';
|
|
1169
|
-
// if (this.conversationSelected) {
|
|
1170
|
-
// // urlPage = 'conversation-detail/' + this.uidConvSelected;
|
|
1171
|
-
// urlPage = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname;
|
|
1172
|
-
// // this.openDetailsWithState(this.conversationSelected);
|
|
1173
|
-
// }
|
|
1174
|
-
// // else {
|
|
1175
|
-
// // this.router.navigateByUrl('detail');
|
|
1176
|
-
// // }
|
|
1177
|
-
|
|
1178
|
-
// const navigationExtras: NavigationExtras = {
|
|
1179
|
-
// state: {
|
|
1180
|
-
// conversationSelected: this.conversationSelected
|
|
1181
|
-
// }
|
|
1182
|
-
// };
|
|
1183
|
-
// this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
|
|
1184
|
-
// }
|
|
1185
|
-
|
|
1186
|
-
// openDetailsWithState(conversationSelected) {
|
|
1187
|
-
// console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
|
|
1188
|
-
// let navigationExtras: NavigationExtras = {
|
|
1189
|
-
// state: {
|
|
1190
|
-
// conversationSelected: conversationSelected
|
|
1191
|
-
// }
|
|
1192
|
-
// };
|
|
1193
|
-
// this.router.navigate(['conversation-detail/' + this.uidConvSelected], navigationExtras);
|
|
1194
|
-
// }
|
|
1195
|
-
|
|
1196
|
-
// /**
|
|
1197
|
-
// * ::: subscribeLoggedUserLogin :::
|
|
1198
|
-
// * effettuato il login:
|
|
1199
|
-
// * 1 - imposto loggedUser
|
|
1200
|
-
// * 2 - dismetto modale
|
|
1201
|
-
// * 3 - inizializzo elenco conversazioni
|
|
1202
|
-
// */
|
|
1203
|
-
// subscribeLoggedUserLogin = (user: any) => {
|
|
1204
|
-
// console.log('3 ************** subscribeLoggedUserLogin', user);
|
|
1205
|
-
// this.loggedUser = user;
|
|
1206
|
-
// try {
|
|
1207
|
-
// closeModal(this.modalController);
|
|
1208
|
-
// } catch (err) {
|
|
1209
|
-
// console.error('-> error:', err);
|
|
1210
|
-
// }
|
|
1211
|
-
// this.initialize();
|
|
1212
|
-
// }
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* ::: conversationsChanged :::
|
|
1216
|
-
* evento richiamato su add, change, remove dell'elenco delle conversazioni
|
|
1217
|
-
* 1 - aggiorno elenco conversazioni
|
|
1218
|
-
* 2 - aggiorno il conto delle nuove conversazioni
|
|
1219
|
-
* 4 - se esiste un uidReciverFromUrl (passato nell'url)
|
|
1220
|
-
* e se esiste una conversazione con lo stesso id di uidReciverFromUrl
|
|
1221
|
-
* imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
1222
|
-
* e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
|
|
1223
|
-
* 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
|
|
1224
|
-
* e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
|
|
1225
|
-
* (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
1226
|
-
*/
|
|
1227
|
-
|
|
1228
|
-
// ------------------------------------------------------------------------------------
|
|
1229
|
-
// ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
|
|
1230
|
-
// when all chat messages are displayed,
|
|
1231
|
-
// that is when in the conversation detail I go to the bottom of the page,
|
|
1232
|
-
// the readAllMessages event is triggered and is intercepted in the conversation list
|
|
1233
|
-
// and modify the current conversation by bringing is_new to false
|
|
1234
|
-
// ------------------------------------------------------------------------------------
|
|
1235
|
-
// readAllMessages = (uid: string) => {
|
|
1236
|
-
// this.logger.log('[CONVS-LIST-PAGE] readAllMessages', uid);
|
|
1237
|
-
// const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
|
|
1238
|
-
// if (conversationSelected) {
|
|
1239
|
-
// conversationSelected.is_new = false;
|
|
1240
|
-
// conversationSelected.status = '0';
|
|
1241
|
-
// conversationSelected.selected = true;
|
|
1242
|
-
// }
|
|
1243
|
-
// }
|
|
1244
1142
|
}
|
|
@@ -103,4 +103,43 @@ export class FirebaseUploadService extends UploadService {
|
|
|
103
103
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
public async delete(userId: string, path: string): Promise<any>{
|
|
107
|
+
const that = this;
|
|
108
|
+
const file_name_photo = 'photo.jpg';
|
|
109
|
+
const file_name_thumb_photo = 'thumb_photo.jpg';
|
|
110
|
+
|
|
111
|
+
that.logger.debug('[FIREBASEUploadSERVICE] delete image for USER', userId, path);
|
|
112
|
+
|
|
113
|
+
let uid = path.split(userId)[1].split('%2F')[1]; // get the UID of the image
|
|
114
|
+
let imageName = path.split(uid + '%2F')[1].split('?')[0];
|
|
115
|
+
|
|
116
|
+
// Create a root reference
|
|
117
|
+
const storageRef = firebase.storage().ref();
|
|
118
|
+
const ref = storageRef.child('public/images/' + userId + '/'+ uid + '/')
|
|
119
|
+
let arrayPromise = []
|
|
120
|
+
await ref.listAll().then((dir => {
|
|
121
|
+
dir.items.forEach(fileRef => arrayPromise.push(this.deleteFile(ref.fullPath, fileRef.name)));
|
|
122
|
+
})).catch(error => {
|
|
123
|
+
that.logger.error('[FIREBASEUploadSERVICE] delete: listAll error', error)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
//AWAIT to return ALL the promise delete()
|
|
127
|
+
return new Promise((resolve, reject)=> {
|
|
128
|
+
Promise.all(arrayPromise).then(()=>{
|
|
129
|
+
resolve(true)
|
|
130
|
+
}).catch((error)=>{
|
|
131
|
+
reject(error)
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// // ------------------------------------
|
|
137
|
+
// // Delete the file photo
|
|
138
|
+
// // ------------------------------------
|
|
139
|
+
private deleteFile(pathToFile, fileName){
|
|
140
|
+
const ref = firebase.storage().ref(pathToFile);
|
|
141
|
+
const childRef = ref.child(fileName);
|
|
142
|
+
return childRef.delete()
|
|
143
|
+
}
|
|
144
|
+
|
|
106
145
|
}
|
|
@@ -323,6 +323,11 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
323
323
|
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
324
324
|
conv.type = snap[k];
|
|
325
325
|
}
|
|
326
|
+
if (k === 'conversation_with_fullname') {
|
|
327
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
328
|
+
conv.conversation_with_fullname = snap[k];
|
|
329
|
+
}
|
|
330
|
+
conv = this.completeConversation(conv)
|
|
326
331
|
});
|
|
327
332
|
}
|
|
328
333
|
|
|
@@ -77,4 +77,26 @@ export class NativeUploadService extends UploadService {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
delete(userId: string, path: string): Promise<any>{
|
|
82
|
+
this.logger.log('[NATIVE UPLOAD] - delete image ... upload', userId)
|
|
83
|
+
const headers = new HttpHeaders({
|
|
84
|
+
Authorization: this.tiledeskToken,
|
|
85
|
+
//'Content-Type': 'multipart/form-data',
|
|
86
|
+
});
|
|
87
|
+
const requestOptions = { headers: headers };
|
|
88
|
+
|
|
89
|
+
//USE IMAGE API
|
|
90
|
+
const that = this;
|
|
91
|
+
const url = this.URL_TILEDESK_IMAGES + '/users' + '?path=' + path
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
that.http.delete(url, requestOptions).subscribe(data => {
|
|
94
|
+
// const downloadURL = this.URL_TILEDESK_IMAGES + '?path=' + data['filename'];
|
|
95
|
+
resolve(true)
|
|
96
|
+
// that.BSStateUpload.next({upload: upload});
|
|
97
|
+
}, (error) => {
|
|
98
|
+
reject(error)
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
80
102
|
}
|