mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
bug adding file to chat on ios solved
This commit is contained in:
@@ -489,7 +489,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 87;
|
CURRENT_PROJECT_VERSION = 88;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.7;
|
MARKETING_VERSION = 3.8;
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 87;
|
CURRENT_PROJECT_VERSION = 88;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.7;
|
MARKETING_VERSION = 3.8;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||||
|
|||||||
Generated
+7
-7
@@ -124,7 +124,7 @@
|
|||||||
"cordova-plugin-filepath": "^1.5.8",
|
"cordova-plugin-filepath": "^1.5.8",
|
||||||
"cordova-plugin-multiple-documents-picker": "^1.0.0",
|
"cordova-plugin-multiple-documents-picker": "^1.0.0",
|
||||||
"cordova-plugin-okhttp": "^2.0.0",
|
"cordova-plugin-okhttp": "^2.0.0",
|
||||||
"cordova-plugin-screen-orientation": "^3.0.2",
|
"cordova-plugin-screen-orientation": "^3.0.4",
|
||||||
"cordova-res": "^0.15.3",
|
"cordova-res": "^0.15.3",
|
||||||
"cordova-sqlite-storage": "^6.0.0",
|
"cordova-sqlite-storage": "^6.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@@ -12878,9 +12878,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/cordova-plugin-screen-orientation": {
|
"node_modules/cordova-plugin-screen-orientation": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.4.tgz",
|
||||||
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg==",
|
"integrity": "sha512-AswRuUKJ8J3HycUilTJsIB50aa9TLrwndPNBFG+wfAPhHEqIBF0HaD0q3HbAK7ypgmaj0cvbzk84qP51IcTfrQ==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"cordovaDependencies": {
|
"cordovaDependencies": {
|
||||||
"4.0.0": {
|
"4.0.0": {
|
||||||
@@ -53547,9 +53547,9 @@
|
|||||||
"integrity": "sha512-k8Fr3Zcv2kcsTD7TYrPPBZX/kEDSCjnPQOtaQBOFmCS3IcJNgWQY8LYST57zkIijaTKeQR7JZo4DvW1Oda3o2Q=="
|
"integrity": "sha512-k8Fr3Zcv2kcsTD7TYrPPBZX/kEDSCjnPQOtaQBOFmCS3IcJNgWQY8LYST57zkIijaTKeQR7JZo4DvW1Oda3o2Q=="
|
||||||
},
|
},
|
||||||
"cordova-plugin-screen-orientation": {
|
"cordova-plugin-screen-orientation": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.4.tgz",
|
||||||
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg=="
|
"integrity": "sha512-AswRuUKJ8J3HycUilTJsIB50aa9TLrwndPNBFG+wfAPhHEqIBF0HaD0q3HbAK7ypgmaj0cvbzk84qP51IcTfrQ=="
|
||||||
},
|
},
|
||||||
"cordova-plugin-statusbar": {
|
"cordova-plugin-statusbar": {
|
||||||
"version": "2.4.3",
|
"version": "2.4.3",
|
||||||
|
|||||||
+1
-1
@@ -140,7 +140,7 @@
|
|||||||
"cordova-plugin-filepath": "^1.5.8",
|
"cordova-plugin-filepath": "^1.5.8",
|
||||||
"cordova-plugin-multiple-documents-picker": "^1.0.0",
|
"cordova-plugin-multiple-documents-picker": "^1.0.0",
|
||||||
"cordova-plugin-okhttp": "^2.0.0",
|
"cordova-plugin-okhttp": "^2.0.0",
|
||||||
"cordova-plugin-screen-orientation": "^3.0.2",
|
"cordova-plugin-screen-orientation": "^3.0.4",
|
||||||
"cordova-res": "^0.15.3",
|
"cordova-res": "^0.15.3",
|
||||||
"cordova-sqlite-storage": "^6.0.0",
|
"cordova-sqlite-storage": "^6.0.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { Storage } from '@ionic/storage';
|
|||||||
import { ChatController } from './controller/chat';
|
import { ChatController } from './controller/chat';
|
||||||
import { register } from 'swiper/element/bundle';
|
import { register } from 'swiper/element/bundle';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
import {ScreenOrientation} from "@ionic-native/screen-orientation/ngx";
|
||||||
|
|
||||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||||
parse: {
|
parse: {
|
||||||
@@ -41,7 +42,8 @@ export class AppComponent {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private storage: Storage,
|
private storage: Storage,
|
||||||
private ChatSystemService: ChatSystemService,
|
private ChatSystemService: ChatSystemService,
|
||||||
private sanitizer: DomSanitizer
|
private sanitizer: DomSanitizer,
|
||||||
|
private screenOrientation: ScreenOrientation
|
||||||
) {
|
) {
|
||||||
|
|
||||||
window["sanitizer"] = this.sanitizer
|
window["sanitizer"] = this.sanitizer
|
||||||
@@ -77,9 +79,12 @@ export class AppComponent {
|
|||||||
if (this.platform.is("tablet")) {
|
if (this.platform.is("tablet")) {
|
||||||
window.screen.orientation.unlock();
|
window.screen.orientation.unlock();
|
||||||
} else if( this.platform.is("mobile")) {
|
} else if( this.platform.is("mobile")) {
|
||||||
// window.screen.orientation.lock('portrait');
|
if(this.platform.is('ios')){
|
||||||
|
this.screenOrientation.lock('portrait')
|
||||||
|
} else {
|
||||||
|
window.screen.orientation.lock('portrait');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,10 @@ export class TokenInterceptor implements HttpInterceptor {
|
|||||||
} else {
|
} else {
|
||||||
/* const pathBeforeGoOut = window.location.pathname */
|
/* const pathBeforeGoOut = window.location.pathname */
|
||||||
this.router.navigateByUrl('/auth', { replaceUrl: true }).then(() =>{
|
this.router.navigateByUrl('/auth', { replaceUrl: true }).then(() =>{
|
||||||
this.httpErrorHandle.httpsSucessMessagge('sessonExpired')
|
if(SessionStore.user.Authorization){
|
||||||
|
this.httpErrorHandle.httpsSucessMessagge('sessonExpired')
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return of(false);
|
return of(false);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
|||||||
import { RouteService } from 'src/app/services/route.service';
|
import { RouteService } from 'src/app/services/route.service';
|
||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { sanitize } from "sanitize-filename-ts";
|
import { sanitize } from "sanitize-filename-ts";
|
||||||
|
import { FilePicker } from '@capawesome/capacitor-file-picker';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -828,8 +829,47 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
async addFileToChat(types: typeof FileType[]) {
|
async addFileToChat(types: typeof FileType[]) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
if(this.platform.is('ios')) {
|
||||||
|
console.log('ios add file ')
|
||||||
|
|
||||||
|
const resultt = await FilePicker.pickFiles({
|
||||||
|
types: ['application/pdf'],
|
||||||
|
multiple: false,
|
||||||
|
readData: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('RESULT', resultt.files[0])
|
||||||
|
|
||||||
|
const blobb = this.fileService.base64toBlob(resultt.files[0].data, resultt.files[0].mimeType)
|
||||||
|
|
||||||
|
const formDataa = new FormData();
|
||||||
|
formDataa.append('blobFile', blobb);
|
||||||
|
/* console.log('add file', fileBase64) */
|
||||||
|
|
||||||
|
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||||
|
file: {
|
||||||
|
"type": resultt.files[0].mimeType,
|
||||||
|
"guid": '',
|
||||||
|
},
|
||||||
|
attachments: [{
|
||||||
|
"title": sanitize(resultt.files[0].name),
|
||||||
|
"name": sanitize(resultt.files[0].name),
|
||||||
|
// "text": "description",
|
||||||
|
"title_link_download": false,
|
||||||
|
}],
|
||||||
|
temporaryData: formDataa,
|
||||||
|
attachmentsModelData: {
|
||||||
|
fileBase64: '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const file: any = await this.fileService.getFileFromDevice(types);
|
const file: any = await this.fileService.getFileFromDevice(types);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { NotificationsService } from 'src/app/services/notifications.service';
|
|||||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { sanitize } from "sanitize-filename-ts";
|
import { sanitize } from "sanitize-filename-ts";
|
||||||
|
import { FilePicker } from '@capawesome/capacitor-file-picker';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -839,9 +840,46 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async addFileToChat(types: typeof FileType[]) {
|
async addFileToChat(types: typeof FileType[]) {
|
||||||
console.log('add file')
|
console.log('add file ')
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
if(this.platform.is('ios')) {
|
||||||
|
console.log('ios add file ')
|
||||||
|
|
||||||
|
const resultt = await FilePicker.pickFiles({
|
||||||
|
types: ['application/pdf'],
|
||||||
|
multiple: false,
|
||||||
|
readData: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('RESULT', resultt.files[0])
|
||||||
|
|
||||||
|
const blobb = this.fileService.base64toBlob(resultt.files[0].data, resultt.files[0].mimeType)
|
||||||
|
|
||||||
|
const formDataa = new FormData();
|
||||||
|
formDataa.append('blobFile', blobb);
|
||||||
|
/* console.log('add file', fileBase64) */
|
||||||
|
|
||||||
|
this.ChatSystemService.getDmRoom(roomId).send({
|
||||||
|
file: {
|
||||||
|
"type": resultt.files[0].mimeType,
|
||||||
|
"guid": '',
|
||||||
|
},
|
||||||
|
attachments: [{
|
||||||
|
"title": sanitize(resultt.files[0].name),
|
||||||
|
"name": sanitize(resultt.files[0].name),
|
||||||
|
// "text": "description",
|
||||||
|
"title_link_download": false,
|
||||||
|
}],
|
||||||
|
temporaryData: formDataa,
|
||||||
|
attachmentsModelData: {
|
||||||
|
fileBase64: '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const file: any = await this.fileService.getFileFromDevice(types);
|
const file: any = await this.fileService.getFileFromDevice(types);
|
||||||
console.log(file)
|
console.log(file)
|
||||||
|
|
||||||
@@ -1239,6 +1277,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataURItoBlobIso(dataURI: any) {
|
||||||
|
const byteString = window.atob(dataURI);
|
||||||
|
const arrayBuffer = new ArrayBuffer(byteString.length);
|
||||||
|
const int8Array = new Uint8Array(arrayBuffer);
|
||||||
|
for (let i = 0; i < byteString.length; i++) {
|
||||||
|
int8Array[i] = byteString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
const blob = new Blob([int8Array], { type: 'application/pdf' });
|
||||||
|
return blob;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -263,5 +263,17 @@ export class FileService {
|
|||||||
return new File([u8arr], filename, {type:mime});
|
return new File([u8arr], filename, {type:mime});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base64toBlobIos(base64Data, contentType) {
|
||||||
|
contentType = contentType || '';
|
||||||
|
const byteCharacters = atob(base64Data);
|
||||||
|
const byteArray = new Uint8Array(byteCharacters.length);
|
||||||
|
|
||||||
|
for (let i = 0; i < byteCharacters.length; i++) {
|
||||||
|
byteArray[i] = byteCharacters.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Blob([byteArray], { type: contentType });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user