fix merge

This commit is contained in:
Peter Maquiran
2022-04-07 14:40:37 +01:00
30 changed files with 1554 additions and 603 deletions
+1
View File
@@ -51,5 +51,6 @@ src/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf
node_modules_ node_modules_
node_modules__ node_modules__
plugins_ plugins_
android
ios ios
src/plugin/beast-orm src/plugin/beast-orm
+3
View File
@@ -24,7 +24,10 @@ dependencies {
implementation project(':capacitor-share') implementation project(':capacitor-share')
implementation project(':capacitor-storage') implementation project(':capacitor-storage')
implementation project(':capacitor-voice-recorder') implementation project(':capacitor-voice-recorder')
implementation project(':capacitor2-file-picker')
implementation "com.soundcloud.android:android-crop:1.0.0@aar" implementation "com.soundcloud.android:android-crop:1.0.0@aar"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.android.support:support-v4:27.+"
implementation "com.squareup.okhttp:okhttp-urlconnection:2+" implementation "com.squareup.okhttp:okhttp-urlconnection:2+"
} }
apply from: "../../node_modules/com-sarriaroman-photoviewer/src/android/photoviewer.gradle" apply from: "../../node_modules/com-sarriaroman-photoviewer/src/android/photoviewer.gradle"
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<manifest package="com.gpr.gabinetedigital" xmlns:android="http://schemas.android.com/apk/res/android"> <manifest package="com.gpr.gabinetedigital" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name=".App" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name=".App" android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="com.gpr.gabinetedigital.MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch"> <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="com.gpr.gabinetedigital.MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@@ -1,17 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest package="com.gpr.gabinetedigital" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name=".App" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="com.gpr.gabinetedigital.MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
@@ -16,5 +16,8 @@
"sound" "sound"
] ]
} }
},
"server": {
"url": "http://192.168.0.69:8101"
} }
} }
@@ -58,5 +58,9 @@
{ {
"pkg": "capacitor-voice-recorder", "pkg": "capacitor-voice-recorder",
"classpath": "com.tchvu3.capacitorvoicerecorder.VoiceRecorder" "classpath": "com.tchvu3.capacitorvoicerecorder.VoiceRecorder"
},
{
"pkg": "capacitor2-file-picker",
"classpath": "com.devmantosh.filepicker.FilePicker"
} }
] ]
+17 -5
View File
@@ -10,11 +10,28 @@
<param name="android-package" value="me.rahul.plugins.sqlDB.sqlDB"/> <param name="android-package" value="me.rahul.plugins.sqlDB.sqlDB"/>
</feature> </feature>
<feature name="SitewaertsDocumentViewer">
<param name="android-package" value="de.sitewaerts.cordova.documentviewer.DocumentViewerPlugin"/>
</feature>
<feature name="File">
<param name="android-package" value="org.apache.cordova.file.FileUtils"/>
<param name="onload" value="true"/>
</feature>
<feature name="FileOpener2">
<param name="android-package" value="io.github.pwlin.cordova.plugins.fileopener2.FileOpener2"/>
</feature>
<feature name="FilePath"> <feature name="FilePath">
<param name="android-package" value="com.hiddentao.cordova.filepath.FilePath"/> <param name="android-package" value="com.hiddentao.cordova.filepath.FilePath"/>
<param name="onload" value="true"/> <param name="onload" value="true"/>
</feature> </feature>
<feature name="MultipleDocumentsPicker">
<param name="android-package" value="com.akeo.cordova.plugin.MultipleDocumentsPicker"/>
</feature>
<feature name="OkHttpPlugin"> <feature name="OkHttpPlugin">
<param name="android-package" value="com.google.cordova.OkHttpPlugin"/> <param name="android-package" value="com.google.cordova.OkHttpPlugin"/>
<param name="onload" value="true"/> <param name="onload" value="true"/>
@@ -40,11 +57,6 @@
<param name="android-package" value="org.apache.cordova.dialogs.Notification"/> <param name="android-package" value="org.apache.cordova.dialogs.Notification"/>
</feature> </feature>
<feature name="File">
<param name="android-package" value="org.apache.cordova.file.FileUtils"/>
<param name="onload" value="true"/>
</feature>
<feature name="Fingerprint"> <feature name="Fingerprint">
<param name="android-package" value="de.niklasmerz.cordova.biometric.Fingerprint"/> <param name="android-package" value="de.niklasmerz.cordova.biometric.Fingerprint"/>
</feature> </feature>
+3
View File
@@ -46,3 +46,6 @@ project(':capacitor-storage').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-voice-recorder' include ':capacitor-voice-recorder'
project(':capacitor-voice-recorder').projectDir = new File('../node_modules/capacitor-voice-recorder/android') project(':capacitor-voice-recorder').projectDir = new File('../node_modules/capacitor-voice-recorder/android')
include ':capacitor2-file-picker'
project(':capacitor2-file-picker').projectDir = new File('../node_modules/capacitor2-file-picker/android')
+5
View File
@@ -25,6 +25,11 @@
"input": "src/assets", "input": "src/assets",
"output": "assets" "output": "assets"
}, },
{
"glob": "**/*",
"input": "node_modules/ngx-extended-pdf-viewer/assets/",
"output": "/assets/"
},
{ {
"glob": "**/*.svg", "glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg", "input": "node_modules/ionicons/dist/ionicons/svg",
+1 -44
View File
@@ -22,7 +22,7 @@
<preference name="SplashScreenDelay" value="3000" /> <preference name="SplashScreenDelay" value="3000" />
<platform name="android"> <platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" /> <application android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true" android:networkSecurityConfig="@xml/network_security_config" />
</edit-config> </edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" /> <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<resource-file src="google-services.json" target="google-services.json" /> <resource-file src="google-services.json" target="google-services.json" />
@@ -46,49 +46,6 @@
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" /> <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" /> <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
</platform> </platform>
<mfp:android>
<mfp:sdkChecksum>3077110622</mfp:sdkChecksum>
<mfp:appChecksum>3619450036</mfp:appChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:android>
<mfp:ios>
<mfp:sdkChecksum>1979143311</mfp:sdkChecksum>
<mfp:appChecksum>1328564293</mfp:appChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:ios>
<mfp:windows>
<mfp:windows8>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windows8>
<mfp:windowsphone8>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windowsphone8>
<mfp:windows10>
<mfp:sdkChecksum>0</mfp:sdkChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security>
</mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows>
<mfp:platformVersion>8.0.0.00-20210905-154328</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" />
<mfp:directUpdateAuthenticityPublicKey />
<mfp:languagePreferences>en</mfp:languagePreferences>
<mfp:APIproxyURL>/adapters/MobileAPIProxy</mfp:APIproxyURL>
<mfp:SDKProtocolVersion>2</mfp:SDKProtocolVersion>
<allow-navigation href="http://localhost:8100" sessionid="9714472a" /> <allow-navigation href="http://localhost:8100" sessionid="9714472a" />
<allow-navigation href="http://localhost:8101" sessionid="4721f88c" /> <allow-navigation href="http://localhost:8101" sessionid="4721f88c" />
<plugin name="cordova-plugin-dbcopy" spec="https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" /> <plugin name="cordova-plugin-dbcopy" spec="https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" />
+566 -50
View File
@@ -799,12 +799,79 @@
"integrity": "sha512-H71nDOOL8Y7kWRLqf6Sums+01Q5msqBW2KhDUTemh1tvY04eSkSXrK0uj/4mmY0Xr16/3zyZmsrxN7CKuRbNRg==", "integrity": "sha512-H71nDOOL8Y7kWRLqf6Sums+01Q5msqBW2KhDUTemh1tvY04eSkSXrK0uj/4mmY0Xr16/3zyZmsrxN7CKuRbNRg==",
"dev": true "dev": true
}, },
"@awesome-cordova-plugins/media-capture": { "@awesome-cordova-plugins/core": {
"version": "5.40.0", "version": "5.40.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/media-capture/-/media-capture-5.40.0.tgz", "resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/core/-/core-5.40.0.tgz",
"integrity": "sha512-Es5qhC6VeCzo0pq0V9txlMwSL3v1ZAUKtT74DDsTnItvbX56ZPdawL4u4fLA40VikaRNYZbYNnkYopifb8nJIw==", "integrity": "sha512-tk5QlnXfSE2Zu3mJVC3f11Guu5iqnLtNkvvClNHjz/e4FsJEmprfXWCv/QImWs5fLsismHcn31LKYBfWIhOv9g==",
"requires": { "requires": {
"@types/cordova": "^0.0.34" "@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@awesome-cordova-plugins/document-viewer": {
"version": "5.41.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/document-viewer/-/document-viewer-5.41.0.tgz",
"integrity": "sha512-90zZvtYuCHTvK55LDoESd7F3OtuDj8AJ0C0Owz+PqZq2J2fUP4fzd7lJE89Cp6vZet7rjiOz7d/8hbTxKMWsdg==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@awesome-cordova-plugins/file": {
"version": "5.41.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file/-/file-5.41.0.tgz",
"integrity": "sha512-1UrtbRdHIDZEFD6UnKFeBpITK+UqrAhr/saJmMsXLjCtsdJFB05abNHzcfdBO+z3mQFK/DnMQ0YdYJtR5x6zYw==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@awesome-cordova-plugins/file-opener": {
"version": "5.41.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/file-opener/-/file-opener-5.41.0.tgz",
"integrity": "sha512-CFdAum1EOxSdi+yMzEkOribU/joaDiqs1lL/ddxj7I78ryzlU+dj7rg6HZKvAN7aTjbWTX6A3p628eNpQoopgg==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@awesome-cordova-plugins/multiple-document-picker": {
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@awesome-cordova-plugins/multiple-document-picker/-/multiple-document-picker-5.40.0.tgz",
"integrity": "sha512-7mYRo2yulfgStK0XsPaTUJigFbYwlQy/qWjLRbNHMbEUOk372a/HnjTUwFBFT+oWX8k0Rn9hjX50Xsqoz46hyQ==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
} }
}, },
"@babel/code-frame": { "@babel/code-frame": {
@@ -3059,6 +3126,21 @@
} }
} }
}, },
"@ionic-native/file-opener": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/file-opener/-/file-opener-5.36.0.tgz",
"integrity": "sha512-UKp3pbqvQXsAtLMJ5JE+KcTMxpjSZMFebf6nvy/KJvwy85JGIaCV4ZVM/H9CFUrHJMWBH6wDbY+WPygnsrl4Yg==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/file-path": { "@ionic-native/file-path": {
"version": "5.36.0", "version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/file-path/-/file-path-5.36.0.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/file-path/-/file-path-5.36.0.tgz",
@@ -5077,6 +5159,11 @@
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
"dev": true "dev": true
}, },
"@types/pdfjs-dist": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@types/pdfjs-dist/-/pdfjs-dist-0.1.2.tgz",
"integrity": "sha512-BvRLWz6RCI8FMKbgfdTCadVwimUv8920gLsnBEAkECjtqIy95jtt+G1ebNQE2b8PTnLjJICPpmBOGhgkSsiPKA=="
},
"@types/prettier": { "@types/prettier": {
"version": "2.4.1", "version": "2.4.1",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.1.tgz", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.1.tgz",
@@ -5525,23 +5612,6 @@
"integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
"dev": true "dev": true
}, },
"android-versions": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.7.0.tgz",
"integrity": "sha512-TCy4b8Dk8YS6A23ZPfhSKqK66JHFq0D8avGYiwvYpjno6HrrcI0DRgHx9+jtkvWYmrsE2vQWgbHJhvGGhhOb0g==",
"dev": true,
"requires": {
"semver": "^5.7.1"
},
"dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}
}
},
"angular-calendar": { "angular-calendar": {
"version": "0.28.28", "version": "0.28.28",
"resolved": "https://registry.npmjs.org/angular-calendar/-/angular-calendar-0.28.28.tgz", "resolved": "https://registry.npmjs.org/angular-calendar/-/angular-calendar-0.28.28.tgz",
@@ -6242,8 +6312,7 @@
"big.js": { "big.js": {
"version": "5.2.2", "version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
"dev": true
}, },
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
@@ -6971,6 +7040,29 @@
"get-blob-duration": "^1.2.0" "get-blob-duration": "^1.2.0"
} }
}, },
"capacitor2-file-picker": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/capacitor2-file-picker/-/capacitor2-file-picker-1.0.0.tgz",
"integrity": "sha512-mumuW44Bx6mMK0V5KEifu6EgBGPsWQ/kXKWMIaHGFYYUtmZTVpDl2DWiQe6VYFbaemhT+0C1EvKbP681RpLOpQ==",
"requires": {
"@capacitor/core": "^2.4.7"
},
"dependencies": {
"@capacitor/core": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-2.5.0.tgz",
"integrity": "sha512-WUkUnqqLtlEYn6tly8t6VR0ABlSVbXdlD/gBbYxx0P+gEqMF9b46uYb2YqyH+8HBDANzTweEySpLfhiSUvYS7w==",
"requires": {
"tslib": "^1.9.0"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}
}
},
"capture-exit": { "capture-exit": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz", "resolved": "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz",
@@ -7264,8 +7356,7 @@
"co": { "co": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
"dev": true
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
@@ -7793,21 +7884,345 @@
} }
}, },
"cordova-android": { "cordova-android": {
"version": "9.1.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-9.1.0.tgz", "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-5.0.0.tgz",
"integrity": "sha512-bzOX9E4eQsOSpa06oZZ7XAGq3DwB73juhhj0oPqHH/khWk0mkCD4aiVYMFoc0fmIaSQvzbY1ww7L6UBW5pyGfg==", "integrity": "sha1-vFlPYEhSWGz3500gQqNzH9dts6o=",
"dev": true, "dev": true,
"requires": { "requires": {
"android-versions": "^1.5.0", "cordova-common": "~1.0.0",
"cordova-common": "^4.0.1", "elementtree": "^0.1.6",
"execa": "^4.0.2", "nopt": "^3.0.1",
"fast-glob": "^3.2.4", "properties-parser": "^0.2.3",
"fs-extra": "^9.0.1", "q": "^1.4.1",
"is-path-inside": "^3.0.2", "shelljs": "^0.5.3"
"nopt": "^4.0.3", },
"properties-parser": "^0.3.1", "dependencies": {
"semver": "^7.3.4", "cordova-common": {
"which": "^2.0.2" "version": "1.0.0",
"bundled": true,
"dev": true,
"requires": {
"bplist-parser": "^0.1.0",
"cordova-registry-mapper": "^1.1.8",
"elementtree": "^0.1.6",
"glob": "^5.0.13",
"osenv": "^0.1.3",
"plist": "^1.1.0",
"q": "^1.4.1",
"semver": "^5.0.1",
"shelljs": "^0.5.1",
"underscore": "^1.8.3",
"unorm": "^1.3.3"
},
"dependencies": {
"bplist-parser": {
"version": "0.1.0",
"bundled": true,
"dev": true
},
"cordova-registry-mapper": {
"version": "1.1.13",
"bundled": true,
"dev": true,
"requires": {
"tape": "^3.5.0"
},
"dependencies": {
"tape": {
"version": "3.5.0",
"bundled": true,
"dev": true,
"requires": {
"deep-equal": "~0.2.0",
"defined": "~0.0.0",
"glob": "~3.2.9",
"inherits": "~2.0.1",
"object-inspect": "~0.4.0",
"resumer": "~0.0.0",
"through": "~2.3.4"
},
"dependencies": {
"deep-equal": {
"version": "0.2.2",
"bundled": true,
"dev": true
},
"defined": {
"version": "0.0.0",
"bundled": true,
"dev": true
},
"glob": {
"version": "3.2.11",
"bundled": true,
"dev": true,
"requires": {
"inherits": "2",
"minimatch": "0.3"
},
"dependencies": {
"minimatch": {
"version": "0.3.0",
"bundled": true,
"dev": true,
"requires": {
"lru-cache": "2",
"sigmund": "~1.0.0"
},
"dependencies": {
"lru-cache": {
"version": "2.7.0",
"bundled": true,
"dev": true
},
"sigmund": {
"version": "1.0.1",
"bundled": true,
"dev": true
}
}
}
}
},
"inherits": {
"version": "2.0.1",
"bundled": true,
"dev": true
},
"object-inspect": {
"version": "0.4.0",
"bundled": true,
"dev": true
},
"resumer": {
"version": "0.0.0",
"bundled": true,
"dev": true,
"requires": {
"through": "~2.3.4"
}
},
"through": {
"version": "2.3.8",
"bundled": true,
"dev": true
}
}
}
}
},
"glob": {
"version": "5.0.15",
"bundled": true,
"dev": true,
"requires": {
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "2 || 3",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"dependencies": {
"inflight": {
"version": "1.0.4",
"bundled": true,
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
},
"dependencies": {
"wrappy": {
"version": "1.0.1",
"bundled": true,
"dev": true
}
}
},
"inherits": {
"version": "2.0.1",
"bundled": true,
"dev": true
},
"minimatch": {
"version": "3.0.0",
"bundled": true,
"dev": true,
"requires": {
"brace-expansion": "^1.0.0"
},
"dependencies": {
"brace-expansion": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"requires": {
"balanced-match": "^0.2.0",
"concat-map": "0.0.1"
},
"dependencies": {
"balanced-match": {
"version": "0.2.1",
"bundled": true,
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
}
}
}
}
},
"once": {
"version": "1.3.2",
"bundled": true,
"dev": true,
"requires": {
"wrappy": "1"
},
"dependencies": {
"wrappy": {
"version": "1.0.1",
"bundled": true,
"dev": true
}
}
},
"path-is-absolute": {
"version": "1.0.0",
"bundled": true,
"dev": true
}
}
},
"osenv": {
"version": "0.1.3",
"bundled": true,
"dev": true,
"requires": {
"os-homedir": "^1.0.0",
"os-tmpdir": "^1.0.0"
},
"dependencies": {
"os-homedir": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"os-tmpdir": {
"version": "1.0.1",
"bundled": true,
"dev": true
}
}
},
"plist": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"requires": {
"base64-js": "0.0.6",
"util-deprecate": "1.0.0",
"xmlbuilder": "2.2.1",
"xmldom": "0.1.x"
},
"dependencies": {
"base64-js": {
"version": "0.0.6",
"bundled": true,
"dev": true
},
"util-deprecate": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"xmlbuilder": {
"version": "2.2.1",
"bundled": true,
"dev": true,
"requires": {
"lodash-node": "~2.4.1"
},
"dependencies": {
"lodash-node": {
"version": "2.4.1",
"bundled": true,
"dev": true
}
}
},
"xmldom": {
"version": "0.1.19",
"bundled": true,
"dev": true
}
}
},
"semver": {
"version": "5.0.3",
"bundled": true,
"dev": true
},
"underscore": {
"version": "1.8.3",
"bundled": true,
"dev": true
},
"unorm": {
"version": "1.4.1",
"bundled": true,
"dev": true
}
}
},
"elementtree": {
"version": "0.1.6",
"bundled": true,
"dev": true,
"requires": {
"sax": "0.3.5"
},
"dependencies": {
"sax": {
"version": "0.3.5",
"bundled": true,
"dev": true
}
}
},
"nopt": {
"version": "3.0.4",
"bundled": true,
"dev": true,
"requires": {
"abbrev": "1"
},
"dependencies": {
"abbrev": {
"version": "1.0.7",
"bundled": true,
"dev": true
}
}
},
"properties-parser": {
"version": "0.2.3",
"bundled": true,
"dev": true
},
"q": {
"version": "1.4.1",
"bundled": true,
"dev": true
},
"shelljs": {
"version": "0.5.3",
"bundled": true,
"dev": true
}
} }
}, },
"cordova-android-support-gradle-release": { "cordova-android-support-gradle-release": {
@@ -8149,11 +8564,20 @@
"integrity": "sha512-FUHI6eEVeoz2VkxbF0P56QlUQLGzXcvw3i4xuXyM9gEct6Y+FA3Xzgl2pJTZcTg5wRqLWzN08kgNoHPkom15pw==", "integrity": "sha512-FUHI6eEVeoz2VkxbF0P56QlUQLGzXcvw3i4xuXyM9gEct6Y+FA3Xzgl2pJTZcTg5wRqLWzN08kgNoHPkom15pw==",
"dev": true "dev": true
}, },
"cordova-plugin-document-viewer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-document-viewer/-/cordova-plugin-document-viewer-1.0.0.tgz",
"integrity": "sha512-LQZiWVU543rLJ0wYoawSdMrAfoxBLWCx8a2CuQjFeav4U9CN16QAh1VHetHaHicp5ZEwTC7Zq/0TNbak6A7bVw=="
},
"cordova-plugin-file": { "cordova-plugin-file": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
"integrity": "sha512-m7cughw327CjONN/qjzsTpSesLaeybksQh420/gRuSXJX5Zt9NfgsSbqqKDon6jnQ9Mm7h7imgyO2uJ34XMBtA==", "integrity": "sha512-m7cughw327CjONN/qjzsTpSesLaeybksQh420/gRuSXJX5Zt9NfgsSbqqKDon6jnQ9Mm7h7imgyO2uJ34XMBtA=="
"dev": true },
"cordova-plugin-file-opener2": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/cordova-plugin-file-opener2/-/cordova-plugin-file-opener2-3.0.5.tgz",
"integrity": "sha512-tjLHDamH5+y0bJZYVe2967L1S4R8tL4Y0rJUzJGoxsyiw3FUlrJNS199POOpzZZ6Xhlntn9a2o7+84r1dMN21A=="
}, },
"cordova-plugin-filepath": { "cordova-plugin-filepath": {
"version": "1.6.0", "version": "1.6.0",
@@ -8190,6 +8614,11 @@
"integrity": "sha512-pVQOrNM7VAuVUMXibAlMGIArrftHPrRs4dUCoE+e2HEFUp3LmN3Yj539LjdUxcWmz/A/cHC65m9E3DS56YJhcg==", "integrity": "sha512-pVQOrNM7VAuVUMXibAlMGIArrftHPrRs4dUCoE+e2HEFUp3LmN3Yj539LjdUxcWmz/A/cHC65m9E3DS56YJhcg==",
"dev": true "dev": true
}, },
"cordova-plugin-multiple-documents-picker": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-multiple-documents-picker/-/cordova-plugin-multiple-documents-picker-1.0.0.tgz",
"integrity": "sha512-MXc1A6bP8/gOSxRRijj5Tp61Sm4zd+yxz5s5ssWD/VQV+MWK88THPZyDuQ2efUbFVs6i2T255mkboLsEEY8EXQ=="
},
"cordova-plugin-network-information": { "cordova-plugin-network-information": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-network-information/-/cordova-plugin-network-information-3.0.0.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-network-information/-/cordova-plugin-network-information-3.0.0.tgz",
@@ -9536,8 +9965,7 @@
"emojis-list": { "emojis-list": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
"dev": true
}, },
"enabled": { "enabled": {
"version": "2.0.0", "version": "2.0.0",
@@ -15741,6 +16169,11 @@
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168="
}, },
"lodash.deburr": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
"integrity": "sha1-3bG7s+8HRYwBd7oH3hRCLLAz/5s="
},
"lodash.isfinite": { "lodash.isfinite": {
"version": "3.3.2", "version": "3.3.2",
"resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz", "resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz",
@@ -16547,6 +16980,26 @@
"tslib": "^2.3.0" "tslib": "^2.3.0"
} }
}, },
"ng2-pdf-viewer": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/ng2-pdf-viewer/-/ng2-pdf-viewer-3.0.8.tgz",
"integrity": "sha512-p2qndFu1wQW4y+xXXw7yk1BhpRo5PGHKWD3PTc7pUULujx9d2vT26lhXR3p9WHitySadGqdCQpkA7W3v1dBlSg==",
"requires": {
"@types/pdfjs-dist": "^0.1.1",
"pdfjs-dist": "1.9.489"
},
"dependencies": {
"pdfjs-dist": {
"version": "1.9.489",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-1.9.489.tgz",
"integrity": "sha1-yuWf7d0WouXRlappUnlVz+QALB0=",
"requires": {
"node-ensure": "^0.0.0",
"worker-loader": "^0.8.0"
}
}
}
},
"ngx-cookie-service": { "ngx-cookie-service": {
"version": "12.0.3", "version": "12.0.3",
"resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-12.0.3.tgz", "resolved": "https://registry.npmjs.org/ngx-cookie-service/-/ngx-cookie-service-12.0.3.tgz",
@@ -16555,6 +17008,15 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
} }
}, },
"ngx-extended-pdf-viewer": {
"version": "13.0.0-alpha.2",
"resolved": "https://registry.npmjs.org/ngx-extended-pdf-viewer/-/ngx-extended-pdf-viewer-13.0.0-alpha.2.tgz",
"integrity": "sha512-/+aTZVW8uubzWHI1KK4eC6QaS2I59IHnJI/0jgyhDkF2bXywB+PR7O/g4aEstRU56lzayh/W8YGSAJbB8tobkw==",
"requires": {
"lodash.deburr": "^4.1.0",
"tslib": "^2.3.0"
}
},
"ngx-image-compress": { "ngx-image-compress": {
"version": "11.0.3", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/ngx-image-compress/-/ngx-image-compress-11.0.3.tgz", "resolved": "https://registry.npmjs.org/ngx-image-compress/-/ngx-image-compress-11.0.3.tgz",
@@ -16632,6 +17094,11 @@
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
}, },
"node-ensure": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz",
"integrity": "sha1-7K52QVDemYYexcgQ/V0Jaxg5Mqc="
},
"node-fetch": { "node-fetch": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
@@ -19009,15 +19476,6 @@
"read": "1" "read": "1"
} }
}, },
"properties-parser": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",
"integrity": "sha1-ExbpU5/7/ZOEXjabIRAiq9R4dxo=",
"dev": true,
"requires": {
"string.prototype.codepointat": "^0.2.0"
}
},
"protobufjs": { "protobufjs": {
"version": "6.11.2", "version": "6.11.2",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz",
@@ -24841,6 +25299,64 @@
"resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz", "resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz",
"integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw==" "integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw=="
}, },
"worker-loader": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-0.8.1.tgz",
"integrity": "sha1-6OmVMx6jTfW/aCloJL+38K1XjUM=",
"requires": {
"loader-utils": "^1.0.2",
"schema-utils": "^0.3.0"
},
"dependencies": {
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "^4.6.0",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0"
}
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
},
"json5": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"requires": {
"minimist": "^1.2.0"
}
},
"loader-utils": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz",
"integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==",
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^1.0.1"
}
},
"schema-utils": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.3.0.tgz",
"integrity": "sha1-9YdyIs4+kx7a4DnxfrNxbnE3+M8=",
"requires": {
"ajv": "^5.0.0"
}
}
}
},
"wrap-ansi": { "wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+15 -4
View File
@@ -31,7 +31,11 @@
"@angular/platform-browser": "~12.1.2", "@angular/platform-browser": "~12.1.2",
"@angular/platform-browser-dynamic": "~12.1.2", "@angular/platform-browser-dynamic": "~12.1.2",
"@angular/router": "~12.1.2", "@angular/router": "~12.1.2",
"@awesome-cordova-plugins/media-capture": "^5.40.0", "@awesome-cordova-plugins/core": "^5.40.0",
"@awesome-cordova-plugins/document-viewer": "^5.41.0",
"@awesome-cordova-plugins/file": "^5.41.0",
"@awesome-cordova-plugins/file-opener": "^5.41.0",
"@awesome-cordova-plugins/multiple-document-picker": "^5.40.0",
"@byteowls/capacitor-filesharer": "^3.0.0", "@byteowls/capacitor-filesharer": "^3.0.0",
"@capacitor-community/camera-preview": "^1.2.1", "@capacitor-community/camera-preview": "^1.2.1",
"@capacitor/android": "3.3.3", "@capacitor/android": "3.3.3",
@@ -63,6 +67,7 @@
"@ionic-native/document-viewer": "^5.36.0", "@ionic-native/document-viewer": "^5.36.0",
"@ionic-native/fcm": "^5.36.0", "@ionic-native/fcm": "^5.36.0",
"@ionic-native/file": "^5.36.0", "@ionic-native/file": "^5.36.0",
"@ionic-native/file-opener": "^5.36.0",
"@ionic-native/file-path": "^5.30.0", "@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0", "@ionic-native/fingerprint-aio": "^4.20.0",
"@ionic-native/http": "^5.36.0", "@ionic-native/http": "^5.36.0",
@@ -102,12 +107,17 @@
"beast-orm": "^1.0.3", "beast-orm": "^1.0.3",
"bootstrap": "^4.5.0", "bootstrap": "^4.5.0",
"build": "0.1.4", "build": "0.1.4",
"capacitor-voice-recorder": "^2.1.0", "capacitor-voice-recorder": "^2.0.0",
"capacitor2-file-picker": "^1.0.0",
"ci": "^2.1.1", "ci": "^2.1.1",
"cordova": "^10.0.0", "cordova": "^10.0.0",
"cordova-plugin-crop": "^0.4.0", "cordova-plugin-crop": "^0.4.0",
"cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git", "cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git",
"cordova-plugin-document-viewer": "^1.0.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-filepath": "^1.5.8", "cordova-plugin-filepath": "^1.5.8",
"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.2",
"cordova-res": "^0.15.3", "cordova-res": "^0.15.3",
@@ -136,7 +146,9 @@
"lite-server": "^2.6.1", "lite-server": "^2.6.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"ng-lazyload-image": "^9.1.2", "ng-lazyload-image": "^9.1.2",
"ng2-pdf-viewer": "^3.0.8",
"ngx-cookie-service": "^12.0.3", "ngx-cookie-service": "^12.0.3",
"ngx-extended-pdf-viewer": "^13.0.0-alpha.2",
"ngx-image-compress": "^11.0.3", "ngx-image-compress": "^11.0.3",
"ngx-image-cropper": "^5.0.1", "ngx-image-cropper": "^5.0.1",
"ngx-letters-avatar": "^1.0.2", "ngx-letters-avatar": "^1.0.2",
@@ -171,14 +183,13 @@
"@types/node": "^12.11.1", "@types/node": "^12.11.1",
"codelyzer": "^6.0.0", "codelyzer": "^6.0.0",
"com-sarriaroman-photoviewer": "^1.2.5", "com-sarriaroman-photoviewer": "^1.2.5",
"cordova-android": "^9.1.0", "cordova-android": "^5.0.0",
"cordova-android-support-gradle-release": "^3.0.1", "cordova-android-support-gradle-release": "^3.0.1",
"cordova-browser": "^6.0.0", "cordova-browser": "^6.0.0",
"cordova-plugin-androidx": "^3.0.0", "cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3", "cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-device": "^2.0.2", "cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2", "cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-fingerprint-aio": "^4.0.2", "cordova-plugin-fingerprint-aio": "^4.0.2",
"cordova-plugin-globalization": "^1.11.0", "cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^4.0.0", "cordova-plugin-inappbrowser": "^4.0.0",
+13 -2
View File
@@ -32,6 +32,11 @@ import {MatDatepickerModule} from '@angular/material/datepicker';
import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core'; import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { Network } from '@ionic-native/network/ngx'; import { Network } from '@ionic-native/network/ngx';
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
import { DocumentViewer } from '@awesome-cordova-plugins/document-viewer/ngx';
import { import {
NgxMatDatetimePickerModule, NgxMatDatetimePickerModule,
NgxMatNativeDateModule, NgxMatNativeDateModule,
@@ -55,13 +60,15 @@ import { CookieService } from 'ngx-cookie-service';
import { ImagePicker } from '@ionic-native/image-picker/ngx'; import { ImagePicker } from '@ionic-native/image-picker/ngx';
import { MediaCapture } from '@ionic-native/media-capture/ngx'; import { MediaCapture } from '@ionic-native/media-capture/ngx';
import { Media } from '@ionic-native/media/ngx'; import { Media } from '@ionic-native/media/ngx';
import { File } from '@ionic-native/file/ngx'; import { File } from '@awesome-cordova-plugins/file/ngx';
import { StreamingMedia } from '@ionic-native/streaming-media/ngx'; import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
import {NgxImageCompressService} from 'ngx-image-compress'; import {NgxImageCompressService} from 'ngx-image-compress';
import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module'; import { CustomImageCachePageRoutingModule } from './services/file/custom-image-cache/custom-image-cache-routing.module';
import { IonicImageLoaderComponent, IonicImageLoaderModule } from 'ionic-image-loader-v5'; import { IonicImageLoaderComponent, IonicImageLoaderModule } from 'ionic-image-loader-v5';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
/* import { FCM } from '@ionic-native/fcm/ngx'; /* import { FCM } from '@ionic-native/fcm/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
@@ -127,7 +134,6 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
ChatService, ChatService,
ScreenOrientation, ScreenOrientation,
Network, Network,
File,
SQLite, SQLite,
CookieService, CookieService,
ImagePicker, ImagePicker,
@@ -136,6 +142,11 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
StreamingMedia, StreamingMedia,
PhotoViewer, PhotoViewer,
NgxImageCompressService, NgxImageCompressService,
MultipleDocumentsPicker,
NgxExtendedPdfViewerModule,
FileOpener,
DocumentViewer
], ],
bootstrap: [AppComponent], bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
@@ -8,6 +8,8 @@ import { ViewMediaPageRoutingModule } from './view-media-routing.module';
import { ViewMediaPage } from './view-media.page'; import { ViewMediaPage } from './view-media.page';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -16,6 +18,8 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
IonicModule, IonicModule,
FontAwesomeModule, FontAwesomeModule,
ViewMediaPageRoutingModule, ViewMediaPageRoutingModule,
PdfViewerModule,
NgxExtendedPdfViewerModule,
], ],
declarations: [ViewMediaPage] declarations: [ViewMediaPage]
}) })
@@ -24,6 +24,13 @@
<img src="{{image}}"> <img src="{{image}}">
</div> </div>
<div *ngIf="type == 'application/pdf'"> <div *ngIf="type == 'application/pdf'">
<iframe width="100%" height="100%" [src]="base64Sanitize" type="application/vnd.openxmlformats-officedocument.wordprocessingml.document"></iframe>
<!-- <pdf-viewer [src]="image"
[render-text]="true"
[original-size]="false"
style="width: 400px; height: 500px"
></pdf-viewer> -->
</div> </div>
</div> </div>
</ion-slide> </ion-slide>
@@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular'; import { ModalController, NavParams } from '@ionic/angular';
import { DomSanitizer} from '@angular/platform-browser';
import { pdfDefaultOptions } from 'ngx-extended-pdf-viewer';
@Component({ @Component({
selector: 'app-view-media', selector: 'app-view-media',
@@ -18,19 +20,53 @@ export class ViewMediaPage implements OnInit {
maxRation: 2 maxRation: 2
}; };
base64Sanitize:any = "";
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private navParams:NavParams, private navParams:NavParams,
public sanitizer: DomSanitizer,
) { ) {
this.image = this.navParams.get('image') this.image = this.navParams.get('image')
this.type = this.navParams.get('type') this.type = this.navParams.get('type')
this.name = this.navParams.get('username') this.name = this.navParams.get('username')
this._updatedAt = this.navParams.get('_updatedAt') this._updatedAt = this.navParams.get('_updatedAt')
pdfDefaultOptions.assetsFolder = 'bleeding-edge';
} }
ngOnInit() { ngOnInit() {
console.log(this.image)
this.base64Sanitize = this.sanitizer.bypassSecurityTrustResourceUrl(this.image);
console.log(this.base64Sanitize)
} }
b64toBlob = (b64Data, contentType = '', sliceSize = 512) => {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, { type: contentType });
return blob;
};
close(){ close(){
this.modalController.dismiss() this.modalController.dismiss()
} }
+7 -1
View File
@@ -105,9 +105,15 @@
<!-- <div *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR'" class="calendar-letters"> --> <!-- <div *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR'" class="calendar-letters"> -->
<div class="calendar-letters cal-reverse" *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && eventService.calendarOwnerIds.length >= 2" class="calendar-letters" [class.cal-reverse]="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && profile == 'mdgpr' " (click)="changeProfile()"> <div class="calendar-letters cal-reverse" *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && eventService.calendarOwnerIds.length >= 2" class="calendar-letters" [class.cal-reverse]="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && profile == 'mdgpr' " (click)="changeProfile()">
<div class="text"> <div class="text" *ngIf="profile == 'mdgpr'">
{{ sessionStore.getInitials }} {{ sessionStore.getInitials }}
</div> </div>
<div class="text" *ngIf="profile == 'pr'">
{{ sessionStore.getManagerInitials }}
</div>
</div> </div>
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR') " (click)="changeProfile()" class="d-md-none btn-no-color resize"> <button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR') " (click)="changeProfile()" class="d-md-none btn-no-color resize">
@@ -37,6 +37,8 @@ import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { MessageService } from 'src/app/services/chat/message.service'; import { MessageService } from 'src/app/services/chat/message.service';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
@Component({ @Component({
selector: 'app-group-messages', selector: 'app-group-messages',
@@ -81,8 +83,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
allowTyping = true; allowTyping = true;
storedFileNames = []; storedFileNames = [];
lastAudioRecorded = ''; lastAudioRecorded = '';
audioRecorded:any = ""; audioRecorded: any = "";
audioDownloaded:any = ""; audioDownloaded: any = "";
durationDisplay = ''; durationDisplay = '';
duration = 0; duration = 0;
showAvatar = true; showAvatar = true;
@@ -113,7 +115,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService, private processesService: ProcessesService,
private CameraService: CameraService, private CameraService: CameraService,
private sanitiser: DomSanitizer, private sanitiser: DomSanitizer,
private alertController: AlertController private alertController: AlertController,
private file: File,
private fileOpener: FileOpener,
) { ) {
this.loggedUserChat = authService.ValidatedUserChat['data']; this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true; this.isGroupCreated = true;
@@ -164,9 +168,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
message: '', message: '',
status: status, status: status,
} }
this.chatService.setUserStatus(body).subscribe(res => { // this.chatService.setUserStatus(body).subscribe(res => {
console.log(res); // console.log(res);
}) // })
} }
deleteMessage(msgId: string) { deleteMessage(msgId: string) {
@@ -227,7 +231,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}, 1000) }, 1000)
} }
async getFile(fileName?:any){ async getFile(fileName?: any) {
const audioFile = await Filesystem.readFile({ const audioFile = await Filesystem.readFile({
path: fileName, path: fileName,
directory: Directory.Data directory: Directory.Data
@@ -257,14 +261,14 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
try { try {
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
} }
else{ else {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
} }
}); });
} catch (error) {} } catch (error) { }
} }
@@ -278,7 +282,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
this.recording = false; this.recording = false;
VoiceRecorder.stopRecording().then(async (result: RecordingData) => { VoiceRecorder.stopRecording().then(async (result: RecordingData) => {
console.log('==================================',result); console.log('==================================', result);
this.recording = false; this.recording = false;
if (result.value && result.value.recordDataBase64) { if (result.value && result.value.recordDataBase64) {
@@ -286,8 +290,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//console.log(recordData); //console.log(recordData);
const fileName = new Date().getTime() + ".mp3"; const fileName = new Date().getTime() + ".mp3";
//Save file //Save file
await this.storage.set('fileName',fileName) await this.storage.set('fileName', fileName)
this.storage.set('recordData',result).then(() => { this.storage.set('recordData', result).then(() => {
console.log('Audio recorded saved', result); console.log('Audio recorded saved', result);
setTimeout(async () => { setTimeout(async () => {
@@ -346,7 +350,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
async deleteRecording(){ async deleteRecording() {
this.storage.remove('fileName'); this.storage.remove('fileName');
this.storage.remove('recordData'); this.storage.remove('recordData');
@@ -397,15 +401,15 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
getRoomInfo() { getRoomInfo() {
this.showLoader = true; this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room => { // this.chatService.getRoomInfo(this.roomId).subscribe(room => {
this.room = room['room']; // this.room = room['room'];
this.roomName = this.room.name.split('-').join(' '); // this.roomName = this.room.name.split('-').join(' ');
if (this.room.customFields.countDownDate) { // if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id); // this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
} // }
this.getGroupContacts(this.room); // this.getGroupContacts(this.room);
this.showLoader = false; // this.showLoader = false;
}); // });
} }
async getChatMembers() { async getChatMembers() {
@@ -481,17 +485,17 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
var byteArrays = new Array(slicesCount); var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize; var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength); var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin); var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) { for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0); bytes[i] = byteCharacters[offset].charCodeAt(0);
} }
byteArrays[sliceIndex] = new Uint8Array(bytes); byteArrays[sliceIndex] = new Uint8Array(bytes);
} }
return new Blob(byteArrays, { type: contentType }); return new Blob(byteArrays, { type: contentType });
} }
async sendAudio(fileName) { async sendAudio(fileName) {
@@ -500,35 +504,35 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
audioFile = recordData; audioFile = recordData;
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = recordData?.value?.recordDataBase64; this.audioRecorded = recordData?.value?.recordDataBase64;
} }
else{ else {
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`; this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
} }
//Converting base64 to blob //Converting base64 to blob
const encodedData = btoa(this.audioRecorded); const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType) const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob) console.log(blob)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
this.wsChatMethodsService.getGroupRoom(roomId).send({ this.wsChatMethodsService.getGroupRoom(roomId).send({
file: { file: {
"type": "application/audio", "type": "application/audio",
"msDuration":audioFile.value.msDuration, "msDuration": audioFile.value.msDuration,
"mimeType":audioFile.value.mimeType, "mimeType": audioFile.value.mimeType,
}, },
attachments: [{ attachments: [{
"title": fileName , "title": fileName,
"title_link_download": true, "title_link_download": true,
"type": "audio" "type": "audio"
}], }],
temporaryData: formData temporaryData: formData
}) })
}); });
this.deleteRecording(); this.deleteRecording();
} }
@@ -710,6 +714,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
"DocId": res.data.selected.Id, "DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto, "Assunto": res.data.selected.Assunto,
}, },
temporaryData: res,
attachments: [{ attachments: [{
"title": res.data.selected.Assunto, "title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc, "description": res.data.selected.DocTypeDesc,
@@ -729,37 +734,60 @@ 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
const file: any = await this.fileService.getFileFromDevice(types); const file: any = await this.fileService.getFileFromDevice(types);
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const response = await fetch(file);
const blob = await response.blob();
console.log('Add file', blob)
const formData = new FormData(); console.log('Add file', JSON.stringify(await this.getBase64(file)))
formData.append("blobFile", blob);
this.wsChatMethodsService.getGroupRoom(roomId).send({ if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name ,
"name": file.name ,
// "text": "description",
//"image_url": file.base64String, // rocketchat
"title_link_download": false,
}],
temporaryData: formData
})
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
const blob = this.base64toBlob(encodedData, file.type)
console.log('Add Blob file', blob)
const formData = new FormData();
formData.append('blobFile', blob);
console.log(formData)
this.wsChatMethodsService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData
});
} else {
console.log('File type invalid')
}
}
getFileReader(): FileReader {
const fileReader = new FileReader();
const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"];
return zoneOriginalInstance || fileReader;
}
getBase64(file) {
var reader = this.getFileReader();
reader.readAsDataURL(file);
return new Promise(resolve => {
reader.onload = function () {
resolve(reader.result)
};
reader.onerror = function (error) {
console.log('Error: ', error);
};
});
} }
@@ -1017,27 +1045,99 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
card.el.style['z-index'] = 11; card.el.style['z-index'] = 11;
} }
b64toBlob(b64Data, contentType) {
contentType = contentType || '';
var sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
var byteCharacters = window.atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
openFile(pdfString, filename) {
const blob = this.b64toBlob(pdfString, 'application/pdf')
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
}
downloadFileMsg(msg: MessageService) { downloadFileMsg(msg: MessageService) {
msg.downloadFileMsg() msg.downloadFileMsg()
} }
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
}
async openPreview(msg: MessageService) { async openPreview(msg: MessageService) {
if (!msg.attachments[0].image_url ||msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') { if(msg.file.type === "application/webtrix") {
this.downloadFileMsg(msg) this.viewDocument(msg.file, msg.attachments.image_url)
} else { } else {
const modal = await this.modalController.create({ if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
component: ViewMediaPage, this.downloadFileMsg(msg)
cssClass: 'modal modal-desktop',
componentProps: { } else {
image: msg.attachments[0].image_url,
type: msg.file.type, var str = msg.attachments[0].image_url;
username: msg.u.name, str = str.substring(1, ((str.length) - 1));
_updatedAt: msg._updatedAt
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.downloadFileFromBrowser(msg.attachments[0].name, str)
/* const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: str,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present(); */
} else {
this.openFile(str, msg.attachments[0].name);
} }
}); }
modal.present();
} }
} }
@@ -1046,7 +1146,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.log(msg); console.log(msg);
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
this.downloadFileMsg(msg) this.downloadFileMsg(msg)
} else {} } else { }
} }
} }
@@ -12,7 +12,6 @@ import { BtnModalDismissPage } from 'src/app/shared/btn-modal-dismiss/btn-modal-
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { LettersAvatarModule } from "ngx-letters-avatar"; import { LettersAvatarModule } from "ngx-letters-avatar";
import { PipesModule } from 'src/app/pipes/pipes.module';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -23,7 +22,6 @@ import { PipesModule } from 'src/app/pipes/pipes.module';
MessagesPageRoutingModule, MessagesPageRoutingModule,
MatMenuModule, MatMenuModule,
LettersAvatarModule, LettersAvatarModule,
PipesModule,
], ],
declarations: [MessagesPage] declarations: [MessagesPage]
}) })
@@ -90,10 +90,10 @@
</div> </div>
<div *ngIf="msg.file.type != 'application/img'"> <div *ngIf="msg.file.type != 'application/img'">
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'"> <div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
<div (click)="docIndex(i); viewDocument(msg, file.title_link)" <div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type"> <span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon> <fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"> <fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
</fa-icon> </fa-icon>
<fa-icon <fa-icon
+218 -144
View File
@@ -20,7 +20,7 @@ import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'; import { Directory, Encoding, Filesystem, FilesystemDirectory, } from '@capacitor/filesystem';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder'; import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Haptics, ImpactStyle } from '@capacitor/haptics'; import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
@@ -40,10 +40,16 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service'; import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera'; import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Plugins, Capacitor } from '@capacitor/core';
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
/* import {Plugins} from '@capacitor/core'; import { StringDecoder } from 'string_decoder';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { DocumentViewer } from '@awesome-cordova-plugins/document-viewer/ngx';
const { Filesystem } = Plugins; */
const IMAGE_DIR = 'stored-images';
@Component({ @Component({
selector: 'app-messages', selector: 'app-messages',
@@ -87,14 +93,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
allowTyping = true; allowTyping = true;
storedFileNames = []; storedFileNames = [];
lastAudioRecorded = ''; lastAudioRecorded = '';
audioRecorded:any = ""; audioRecorded: any = "";
audioDownloaded:any = ""; audioDownloaded: any = "";
durationDisplay = ''; durationDisplay = '';
duration = 0; duration = 0;
@ViewChild('recordbtn', { read: ElementRef }) recordBtn: ElementRef; @ViewChild('recordbtn', { read: ElementRef }) recordBtn: ElementRef;
myAudio: any; myAudio: any;
downloadfile: any; downloadfile: any;
downloadFile: any; downloadFile: any;
files: any[] = [];
@ViewChild('filechooser') fileChooserElementRef: ElementRef;
//items: File[] = [];
fileSelected?: Blob;
pdfUrl?: string;
base64File: string;
downloadProgess: number; downloadProgess: number;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
@@ -123,8 +135,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService, private processesService: ProcessesService,
private storage: Storage, private storage: Storage,
private fileToBase64Service: FileToBase64Service, private fileToBase64Service: FileToBase64Service,
private multipleDocumentsPicker: MultipleDocumentsPicker,
private sant: DomSanitizer,
private file: File,
private fileOpener: FileOpener,
private sanitiser: DomSanitizer, private sanitiser: DomSanitizer,
private alertController: AlertController private alertController: AlertController,
private document: DocumentViewer
) { ) {
this.loggedUser = authService.ValidatedUserChat['data']; this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId'); this.roomId = this.navParams.get('roomId');
@@ -212,16 +229,16 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
try { try {
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
} }
else{ else {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
} }
}); });
} catch (error) {} } catch (error) { }
} }
@@ -267,6 +284,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
await alertPopup.present(); await alertPopup.present();
} }
this.recording = true;
VoiceRecorder.startRecording()
.then((result: GenericResponse) => console.log(result.value))
.catch(error => console.log(error));
this.calculateDuration();
} }
stopRecording() { stopRecording() {
@@ -285,8 +307,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//console.log(recordData); //console.log(recordData);
const fileName = new Date().getTime() + ".mp3"; const fileName = new Date().getTime() + ".mp3";
//Save file //Save file
this.storage.set('fileName',fileName); this.storage.set('fileName', fileName);
this.storage.set('recordData',result).then(() => { this.storage.set('recordData', result).then(() => {
console.log('Audio recorded saved'); console.log('Audio recorded saved');
}) })
} }
@@ -296,7 +318,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}, 1000); }, 1000);
} }
async deleteRecording(){ async deleteRecording() {
this.storage.remove('fileName'); this.storage.remove('fileName');
this.storage.remove('recordData'); this.storage.remove('recordData');
@@ -415,17 +437,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
var byteArrays = new Array(slicesCount); var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize; var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength); var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin); var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) { for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0); bytes[i] = byteCharacters[offset].charCodeAt(0);
} }
byteArrays[sliceIndex] = new Uint8Array(bytes); byteArrays[sliceIndex] = new Uint8Array(bytes);
} }
return new Blob(byteArrays, { type: contentType }); return new Blob(byteArrays, { type: contentType });
} }
async sendAudio(fileName) { async sendAudio(fileName) {
const roomId = this.roomId const roomId = this.roomId
@@ -433,92 +455,48 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
audioFile = recordData; audioFile = recordData;
if (recordData?.value?.recordDataBase64.includes('data:audio')) {
if(recordData?.value?.recordDataBase64) { this.audioRecorded = recordData?.value?.recordDataBase64;
if(recordData.value.recordDataBase64.includes('data:audio')){ }
this.audioRecorded = recordData.value.recordDataBase64; else {
} this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
console.log(this.audioRecorded);
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob)
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration":audioFile.value.msDuration,
"mimeType":audioFile.value.mimeType,
},
attachments: [{
"title": fileName ,
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData
})
} else {
alert('no audio')
} }
console.log(this.audioRecorded);
}); //Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob)
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration": audioFile.value.msDuration,
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": fileName,
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData
})
});
this.deleteRecording(); this.deleteRecording();
} }
blobToBase64 = blob => { viewDocument(file: any, url?: string) {
const reader = new FileReader(); console.log()
reader.readAsDataURL(blob); if (file.type == "application/webtrix") {
return new Promise(resolve => { this.openViewDocumentModal(file);
reader.onloadend = () => {
resolve(reader.result);
};
});
};
viewDocument(msg: any, url?: string) {
console.log(msg)
if (msg.attachments.type == "application/webtrix") {
//this.openViewDocumentModal(file);
} }
else {
if (msg.attachments.type == "application/pdf") { let fullUrl = "https://www.tabularium.pt" + url;
this.fileService.viewDocumentByUrl(fullUrl);
try {
const writeSecretFile = async () => {
await Filesystem.writeFile({
path: msg.attachments.name,
data: msg.attachments.image_url,
directory: Directory.Documents,
encoding: Encoding.UTF8,
});
};
console.log('WRITE', writeSecretFile);
const readSecretFile = async () => {
const contents = await Filesystem.readFile({
path: msg.attachments.name,
directory: Directory.Documents,
encoding: Encoding.UTF8,
});
console.log('secrets:', contents);
};
console.log('READ', readSecretFile);
} catch (e) {
console.error("Unable to write file", e);
}
} }
} }
@@ -751,6 +729,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"DocId": res.data.selected.Id, "DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto, "Assunto": res.data.selected.Assunto,
}, },
temporaryData: res,
attachments: [{ attachments: [{
"title": res.data.selected.Assunto, "title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc, "description": res.data.selected.DocTypeDesc,
@@ -801,37 +780,62 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
getFileReader(): FileReader {
const fileReader = new FileReader();
const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"];
return zoneOriginalInstance || fileReader;
}
async addFileToChat(types: typeof FileType[]) { async addFileToChat(types: typeof FileType[]) {
const roomId = this.roomId const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types); const file: any = await this.fileService.getFileFromDevice(types);
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const blob = new Blob(file, { type: file.type })
console.log('Add file', blob)
const formData = new FormData(); console.log('Add file', JSON.stringify(await this.getBase64(file)))
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({ if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData
})
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
const blob = this.base64toBlob(encodedData, file.type)
console.log('Add Blob file', blob)
const formData = new FormData();
formData.append('blobFile', blob);
console.log(formData)
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData
});
} else {
console.log('File type invalid')
}
}
getBase64(file) {
var reader = this.getFileReader();
reader.readAsDataURL(file);
return new Promise(resolve => {
reader.onload = function () {
resolve(reader.result)
};
reader.onerror = function (error) {
console.log('Error: ', error);
};
});
} }
@@ -949,39 +953,109 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
testeDownload(msg: MessageService) { /* testeDownload(msg: MessageService) {
this.downloadFile = ""; this.downloadFile = "";
this.AttachmentsService.downloadFileAndStore(msg.file.guid); this.AttachmentsService.downloadFileAndStore(msg.file.guid);
} } */
downloadFileMsg(msg: MessageService) { downloadFileMsg(msg: MessageService) {
msg.downloadFileMsg() msg.downloadFileMsg();
} }
testDownlod(msg: MessageService) { b64toBlob(b64Data, contentType) {
this.AttachmentsService.downloadFileAndStore(msg.file.guid) contentType = contentType || '';
var sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
var byteCharacters = window.atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
} }
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, type)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
}
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
}
async openPreview(msg) { async openPreview(msg) {
console.log(msg); console.log(msg);
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' || !msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { if(msg.file.type === "application/webtrix") {
this.downloadFile(msg) this.viewDocument(msg.file, msg.attachments.image_url)
//this.testDownlod(msg)
} else { } else {
const modal = await this.modalController.create({
component: ViewMediaPage, if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
cssClass: 'modal modal-desktop', this.downloadFileMsg(msg)
componentProps: { //this.testDownlod(msg)
image: msg.attachments[0].image_url,
type: msg.file.type, } else {
username: msg.u.name, var str = msg.attachments[0].image_url;
_updatedAt: msg._updatedAt str = str.substring(1, ((str.length) - 1));
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.downloadFileFromBrowser(msg.attachments[0].name, str)
/* const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: str,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present(); */
} else {
this.openFile(str, msg.attachments[0].name, msg.file.type);
} }
});
modal.present(); }
} }
} }
@@ -990,7 +1064,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.log(msg); console.log(msg);
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
this.downloadFileMsg(msg) this.downloadFileMsg(msg)
} else {} } else { }
} }
+6 -3
View File
@@ -30,12 +30,13 @@ export class ChatService {
private authService: AuthService, private authService: AuthService,
private storage: Storage, private storage: Storage,
private storageService:StorageService, private storageService:StorageService,
public p: PermissionService, public p: PermissionService) {
)
{ if(this.p.userPermission(this.p.permissionList.Chat.access)){
this.loggedUserChat = authService.ValidatedUserChat; this.loggedUserChat = authService.ValidatedUserChat;
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
if(this.p.userPermission(this.p.permissionList.Chat.access)) { if(this.p.userPermission(this.p.permissionList.Chat.access)) {
this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId);
this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken);
@@ -46,6 +47,8 @@ export class ChatService {
} }
}
getDocumentDetails(url:string){ getDocumentDetails(url:string){
let headersc = new HttpHeaders(); let headersc = new HttpHeaders();
headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId); headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId);
+9 -4
View File
@@ -233,12 +233,17 @@ export class MessageService {
} else if (event.type === HttpEventType.Response) { } else if (event.type === HttpEventType.Response) {
if (this.file.type == "application/img") { if (this.file.type == "application/img") {
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '')); downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (this.file.type === 'application/pdf') { } else if (this.file.type != "application/img") {
downloadFile = event.body as any;
} else if (this.file.type == 'application/audio') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''); downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} console.log(downloadFile)
} /* else if (this.file.type == 'application/audio') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} else if (this.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} */
console.log('Download file ',downloadFile )
this.attachments[0] = { this.attachments[0] = {
image_url: downloadFile, image_url: downloadFile,
@@ -239,9 +239,9 @@
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light"> <ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon> <ion-icon name="calendar"></ion-icon>
</ion-fab-button> </ion-fab-button>
<!-- <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light"> <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon> <ion-icon name="document"></ion-icon>
</ion-fab-button> --> </ion-fab-button>
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light"> <ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon> <ion-icon name="image"></ion-icon>
</ion-fab-button> </ion-fab-button>
@@ -1,5 +1,5 @@
import { Component, OnChanges, OnInit, Input, SimpleChanges, ChangeDetectorRef, Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy } from '@angular/core'; import { Component, OnChanges, OnInit, Input, SimpleChanges, ChangeDetectorRef, Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy } from '@angular/core';
import { ActionSheetController, AnimationController, IonSlides, MenuController, ModalController, PopoverController } from '@ionic/angular'; import { ActionSheetController, AnimationController, IonSlides, MenuController, ModalController, PopoverController, Platform } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
@@ -36,7 +36,10 @@ import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder'; import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'; import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { AlertController, Platform, NavParams } from '@ionic/angular'; import { AlertController, NavParams } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
/* /*
import * as pdfjsLib from 'pdfjs-dist'; import * as pdfjsLib from 'pdfjs-dist';
@@ -95,8 +98,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
allowTyping = true; allowTyping = true;
storedFileNames = []; storedFileNames = [];
lastAudioRecorded = ''; lastAudioRecorded = '';
audioRecorded:any = ""; audioRecorded: any = "";
audioDownloaded:any = ""; audioDownloaded: any = "";
durationDisplay = ''; durationDisplay = '';
duration = 0; duration = 0;
@@ -124,7 +127,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private CameraService: CameraService, private CameraService: CameraService,
private toastService: ToastService, private toastService: ToastService,
private sanitiser: DomSanitizer, private sanitiser: DomSanitizer,
private alertController: AlertController private alertController: AlertController,
private file: File,
private platform: Platform,
private fileOpener: FileOpener,
) { ) {
console.log('OnCONSTRUCTOR'); console.log('OnCONSTRUCTOR');
@@ -146,7 +153,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.showAvatar = false this.showAvatar = false
setTimeout(()=>{ setTimeout(() => {
this.scrollToBottomClicked() this.scrollToBottomClicked()
this.showAvatar = true this.showAvatar = true
}, 50) }, 50)
@@ -156,7 +163,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
ngOnInit() { ngOnInit() {
this.loggedUser=this.loggedUserChat; this.loggedUser = this.loggedUserChat;
setTimeout(() => { setTimeout(() => {
this.getRoomInfo(); this.getRoomInfo();
}, 1000); }, 1000);
@@ -263,7 +270,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}, 1000) }, 1000)
} }
async getFile(fileName?:any){ async getFile(fileName?: any) {
const audioFile = await Filesystem.readFile({ const audioFile = await Filesystem.readFile({
path: fileName, path: fileName,
directory: Directory.Data directory: Directory.Data
@@ -281,14 +288,14 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
} }
else{ else {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
} }
}); });
} catch (error) {} } catch (error) { }
} }
@@ -354,8 +361,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
//console.log(recordData); //console.log(recordData);
const fileName = new Date().getTime() + ".mp3"; const fileName = new Date().getTime() + ".mp3";
//Save file //Save file
this.storage.set('fileName',fileName); this.storage.set('fileName', fileName);
this.storage.set('recordData',result).then(() => { this.storage.set('recordData', result).then(() => {
console.log('Audio recorded saved'); console.log('Audio recorded saved');
}) })
} }
@@ -463,17 +470,17 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
var byteArrays = new Array(slicesCount); var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize; var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength); var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin); var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) { for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0); bytes[i] = byteCharacters[offset].charCodeAt(0);
} }
byteArrays[sliceIndex] = new Uint8Array(bytes); byteArrays[sliceIndex] = new Uint8Array(bytes);
} }
return new Blob(byteArrays, { type: contentType }); return new Blob(byteArrays, { type: contentType });
} }
async sendAudio(fileName) { async sendAudio(fileName) {
const roomId = this.roomId const roomId = this.roomId
@@ -481,36 +488,36 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
audioFile = recordData; audioFile = recordData;
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = recordData?.value?.recordDataBase64; this.audioRecorded = recordData?.value?.recordDataBase64;
} }
else{ else {
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`; this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
} }
//Converting base64 to blob //Converting base64 to blob
const encodedData = btoa(this.audioRecorded); const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType) const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob) console.log(blob)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
this.wsChatMethodsService.getGroupRoom(roomId).send({ this.wsChatMethodsService.getGroupRoom(roomId).send({
file: { file: {
"type": "application/audio", "type": "application/audio",
"msDuration":audioFile.value.msDuration, "msDuration": audioFile.value.msDuration,
"mimeType":audioFile.value.mimeType, "mimeType": audioFile.value.mimeType,
}, },
attachments: [{ attachments: [{
"title": fileName , "title": fileName,
"title_link_download": true, "title_link_download": true,
"type": "audio" "type": "audio"
}], }],
temporaryData: formData temporaryData: formData
}) })
}); });
this.deleteRecording(); this.deleteRecording();
} }
@@ -761,7 +768,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
//const imageData = await this.fileToBase64Service.convert(file) //const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData) //console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!); const response = await fetch('data:image/jpeg;base64,' + file.base64String!);
const blob = await response.blob(); const blob = await response.blob();
const formData = new FormData(); const formData = new FormData();
@@ -774,8 +781,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}, },
temporaryData: formData, temporaryData: formData,
attachments: [{ attachments: [{
"title": file.path , "title": file.path,
"image_url": 'data:image/jpeg;base64,' +file.base64String, "image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description", "text": "description",
"title_link_download": false, "title_link_download": false,
}] }]
@@ -789,7 +796,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const image = await this.CameraService.takePicture(); const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image) await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles(); const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto); const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage); const base64 = await fetch(capturedImage);
const blob = await base64.blob(); const blob = await base64.blob();
@@ -802,7 +809,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
"guid": '' "guid": ''
}, },
attachments: [{ attachments: [{
"title": capturedImageTitle , "title": capturedImageTitle,
"image_url": capturedImage, "image_url": capturedImage,
"text": "description", "text": "description",
"title_link_download": false, "title_link_download": false,
@@ -833,13 +840,13 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(async res=>{ modal.onDidDismiss().then(async res => {
const data = res.data; const data = res.data;
if(data.selected) { if (data.selected) {
this.wsChatMethodsService.getGroupRoom(roomId).send({ this.wsChatMethodsService.getGroupRoom(roomId).send({
file:{ file: {
"name": res.data.selected.Assunto, "name": res.data.selected.Assunto,
"type": "application/webtrix", "type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType, "ApplicationId": res.data.selected.ApplicationType,
@@ -865,7 +872,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
}); });
} }
async addFileToChatMobile(types: typeof FileType[] ) { async addFileToChatMobile(types: typeof FileType[]) {
const roomId = this.roomId const roomId = this.roomId
const file = await Camera.getPhoto({ const file = await Camera.getPhoto({
@@ -878,7 +885,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
//const imageData = await this.fileToBase64Service.convert(file) //const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData) //console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!); const response = await fetch('data:image/jpeg;base64,' + file.base64String!);
const blob = await response.blob(); const blob = await response.blob();
const formData = new FormData(); const formData = new FormData();
@@ -891,8 +898,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}, },
temporaryData: formData, temporaryData: formData,
attachments: [{ attachments: [{
"title": file.path , "title": file.path,
"image_url": 'data:image/jpeg;base64,' +file.base64String, "image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description", "text": "description",
"title_link_download": false, "title_link_download": false,
}] }]
@@ -901,52 +908,63 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
async addFileToChat(types: typeof FileType[] ) { async addFileToChat(types: typeof FileType[]) {
const roomId = this.roomId const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types); const file: any = await this.fileService.getFileFromDevice(types);
console.log('Add file', file) console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const blob = new Blob([file],{type: file.type})
console.log('Add file', blob)
const formData = new FormData(); if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
formData.append("blobFile", blob);
let pdfBase64; const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
this.blobToBase64(blob).then(res => { const blob = this.base64toBlob(encodedData, file.type)
console.log('Base64 pdf', res); console.log('Add Blob file', blob)
this.wsChatMethodsService.getGroupRoom(roomId).send({
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: { file: {
"type": file.type, "type": file.type,
"guid": '', "guid": '',
}, },
attachments: [{ attachments: [{
"title": file.name , "title": file.name,
"name": file.name , "name": file.name,
"image_url": res, //"image_url": res,
// "text": "description", // "text": "description",
"title_link_download": false, "title_link_download": false,
}], }],
temporaryData: formData temporaryData: formData
}) })
});
} else {
console.log('File type invalid')
}
} }
blobToBase64 = blob => { getFileReader(): FileReader {
const reader = new FileReader(); const fileReader = new FileReader();
reader.readAsDataURL(blob); const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"];
return zoneOriginalInstance || fileReader;
}
getBase64(file) {
var reader = this.getFileReader();
reader.readAsDataURL(file);
return new Promise(resolve => { return new Promise(resolve => {
reader.onloadend = () => { reader.onload = function () {
resolve(reader.result); resolve(reader.result)
};
reader.onerror = function (error) {
console.log('Error: ', error);
}; };
}); });
};
}
bookMeeting() { bookMeeting() {
let data = { let data = {
@@ -992,7 +1010,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res) => { modal.onDidDismiss().then(async (res) => {
console.log(res['data']); console.log(res['data']);
const roomId = this.roomId; const roomId = this.roomId;
@@ -1034,23 +1052,95 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
msg.downloadFileMsg() msg.downloadFileMsg()
} }
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
}
b64toBlob(b64Data, contentType) {
contentType = contentType || '';
var sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
var byteCharacters = window.atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, type)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
}
async openPreview(msg) { async openPreview(msg) {
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) { if (msg.file.type === "application/webtrix") {
this.downloadFileMsg(msg) this.viewDocument(msg.file, msg.attachments.image_url)
} else { } else {
const modal = await this.modalController.create({
component: ViewMediaPage, if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
cssClass: 'modal modal-desktop', this.downloadFileMsg(msg)
componentProps: {
image: msg.attachments[0].image_url, } else {
type: msg.file.type,
username: msg.u.name, var str = msg.attachments[0].image_url;
_updatedAt: msg._updatedAt str = str.substring(1, ((str.length) - 1));
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.downloadFileFromBrowser(msg.attachments[0].name, str)
} else if (this.platform.is('tablet')) {
this.openFile(str, msg.attachments[0].name, msg.file.type);
} }
});
modal.present(); /* const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: str,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present(); */
}
} }
} }
@@ -1059,7 +1149,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
console.log(msg); console.log(msg);
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
this.downloadFileMsg(msg) this.downloadFileMsg(msg)
} else {} } else { }
} }
} }
@@ -97,6 +97,7 @@
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon> <fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"> <fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
</fa-icon> </fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon <fa-icon
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
icon="file-word" class="excel-icon"></fa-icon> icon="file-word" class="excel-icon"></fa-icon>
@@ -198,9 +199,9 @@
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light"> <ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon> <ion-icon name="calendar"></ion-icon>
</ion-fab-button> </ion-fab-button>
<!-- <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light"> <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon> <ion-icon name="document"></ion-icon>
</ion-fab-button> --> </ion-fab-button>
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light"> <ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon> <ion-icon name="image"></ion-icon>
</ion-fab-button> </ion-fab-button>
+240 -132
View File
@@ -36,6 +36,9 @@ import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, Cur
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'; import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { AlertController, Platform, NavParams } from '@ionic/angular'; import { AlertController, Platform, NavParams } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
const IMAGE_DIR = 'stored-images'; const IMAGE_DIR = 'stored-images';
@Component({ @Component({
@@ -77,7 +80,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
scrollToBottomBtn = false; scrollToBottomBtn = false;
longPressActive = false; longPressActive = false;
frameUrl: any; frameUrl: any;
downloadFile: any; downloadFile: string;
massages: MessageService[] = [] massages: MessageService[] = []
showAvatar = true; showAvatar = true;
@@ -86,8 +89,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
allowTyping = true; allowTyping = true;
storedFileNames = []; storedFileNames = [];
lastAudioRecorded = ''; lastAudioRecorded = '';
audioRecorded:any = ""; audioRecorded: any = "";
audioDownloaded:any = ""; audioDownloaded: any = "";
durationDisplay = ''; durationDisplay = '';
duration = 0; duration = 0;
@@ -121,7 +124,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private processesService: ProcessesService, private processesService: ProcessesService,
private fileToBase64Service: FileToBase64Service, private fileToBase64Service: FileToBase64Service,
private sanitiser: DomSanitizer, private sanitiser: DomSanitizer,
private alertController: AlertController private alertController: AlertController,
private file: File,
private platform: Platform,
private fileOpener: FileOpener,
) { ) {
this.loggedUser = authService.ValidatedUserChat['data']; this.loggedUser = authService.ValidatedUserChat['data'];
@@ -258,7 +264,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}, 1000) }, 1000)
} }
async getFile(fileName?:any){ async getFile(fileName?: any) {
const audioFile = await Filesystem.readFile({ const audioFile = await Filesystem.readFile({
path: fileName, path: fileName,
directory: Directory.Data directory: Directory.Data
@@ -276,16 +282,25 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.storage.get('recordData').then((recordData) => { this.storage.get('recordData').then((recordData) => {
console.log(recordData); console.log(recordData);
if(recordData?.value?.recordDataBase64.includes('data:audio')){ if (recordData?.value?.recordDataBase64.includes('data:audio')) {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData?.value?.recordDataBase64);
} }
else{ else {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`); this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`);
} }
}); });
} catch (error) {} } catch (error) { }
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if (recordData.value.recordDataBase64.includes('data:audio')) {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
}
else {
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
} }
async startRecording() { async startRecording() {
@@ -336,8 +351,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//console.log(recordData); //console.log(recordData);
const fileName = new Date().getTime() + ".mp3"; const fileName = new Date().getTime() + ".mp3";
//Save file //Save file
this.storage.set('fileName',fileName); this.storage.set('fileName', fileName);
this.storage.set('recordData',result).then(() => { this.storage.set('recordData', result).then(() => {
console.log('Audio recorded saved'); console.log('Audio recorded saved');
}) })
} }
@@ -347,7 +362,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}, 1000); }, 1000);
} }
async deleteRecording(){ async deleteRecording() {
this.storage.remove('fileName'); this.storage.remove('fileName');
this.storage.remove('recordData'); this.storage.remove('recordData');
@@ -397,6 +412,71 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.wsChatMethodsService.getDmRoom(this.roomId).send({}) this.wsChatMethodsService.getDmRoom(this.roomId).send({})
} }
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if (recordData.value.recordDataBase64.includes('data:audio')) {
this.audioRecorded = recordData.value.recordDataBase64;
}
else {
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob)
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration": audioFile.value.msDuration,
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": fileName,
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData
})
});
this.deleteRecording();
}
deleteMessage(msgId: string, msg: MessageService) {
this.wsChatMethodsService.getDmRoom(this.roomId).sendDeleteRequest(msgId)
if (msg.file.type == "application/webtrix") {
this.openViewDocumentModal(msg.file);
}
else {
console.log('PDF CLICK', msg)
var str = msg.attachments[0].image_url;
str = str.substring(1, ((str.length) - 1));
const encodedData = btoa(str);
/* let fullUrl;
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
this.frameUrl = fullUrl; */
let file = this.base64toBlob(encodedData, 'application/pdf')
let fileURL = URL.createObjectURL(file)
console.log('PDF CLICK', fileURL)
window.open(fileURL);
// this.chatService.getDocumentDetails(fullUrl);
}
}
base64toBlob(base64Data, contentType) { base64toBlob(base64Data, contentType) {
contentType = contentType || ''; contentType = contentType || '';
var sliceSize = 1024; var sliceSize = 1024;
@@ -406,88 +486,16 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
var byteArrays = new Array(slicesCount); var byteArrays = new Array(slicesCount);
for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
var begin = sliceIndex * sliceSize; var begin = sliceIndex * sliceSize;
var end = Math.min(begin + sliceSize, bytesLength); var end = Math.min(begin + sliceSize, bytesLength);
var bytes = new Array(end - begin); var bytes = new Array(end - begin);
for (var offset = begin, i = 0; offset < end; ++i, ++offset) { for (var offset = begin, i = 0; offset < end; ++i, ++offset) {
bytes[i] = byteCharacters[offset].charCodeAt(0); bytes[i] = byteCharacters[offset].charCodeAt(0);
} }
byteArrays[sliceIndex] = new Uint8Array(bytes); byteArrays[sliceIndex] = new Uint8Array(bytes);
} }
return new Blob(byteArrays, { type: contentType }); return new Blob(byteArrays, { type: contentType });
}
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if(recordData?.value?.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData?.value?.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
console.log(this.audioRecorded);
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.base64toBlob(encodedData, recordData.value.mimeType)
console.log(blob)
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/audio",
"msDuration":audioFile.value.msDuration,
"mimeType":audioFile.value.mimeType,
},
attachments: [{
"title": fileName ,
"title_link_download": true,
"type": "audio"
}],
temporaryData: formData
})
});
this.deleteRecording();
}
deleteMessage(msgId: string, msg:MessageService) {
this.wsChatMethodsService.getDmRoom(this.roomId).sendDeleteRequest(msgId)
}
async viewDocument(msg: any, url?: string) {
if (msg.file.type == "application/img") {
let response: any = await this.AttachmentsService.getFile(msg.file.guid).toPromise();
console.log(response);
alert(response);
//this.openPreview(msg);
}
else if (msg.file.type == "application/webtrix") {
this.openViewDocumentModal(msg.file);
}
else {
console.log('PDF CLICK', msg)
/* let fullUrl;
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
this.frameUrl = fullUrl; */
let file = new Blob([msg.attachments[0].image_url], { type: 'application/pdf' });
let fileURL = URL.createObjectURL(file)
window.open(fileURL);
// this.chatService.getDocumentDetails(fullUrl);
}
} }
@@ -737,6 +745,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(async res => { modal.onDidDismiss().then(async res => {
console.log('webTrix ', res.data)
const data = res.data; const data = res.data;
const roomId = this.roomId const roomId = this.roomId
@@ -750,6 +759,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
"DocId": res.data.selected.Id, "DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto, "Assunto": res.data.selected.Assunto,
}, },
temporaryData: res,
attachments: [{ attachments: [{
"title": res.data.selected.Assunto, "title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc, "description": res.data.selected.DocTypeDesc,
@@ -808,19 +818,23 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const file: any = await this.fileService.getFileFromDevice(types); const file: any = await this.fileService.getFileFromDevice(types);
//if (file.type == "application/pdf") {
console.log('Add file', file) console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => { /* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee) console.log('Add file', filee)
}) */ }) */
const blob = new Blob([file], { type: file.type }) console.log('Add file', JSON.stringify(await this.getBase64(file)))
console.log('Add file', blob)
const formData = new FormData(); if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
formData.append("blobFile", blob);
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
const blob = this.base64toBlob(encodedData, file.type)
console.log('Add Blob file', blob)
const formData = new FormData();
formData.append("blobFile", blob);
let pdfBase64;
this.blobToBase64(blob).then(res => {
console.log('Base64 pdf', res);
this.wsChatMethodsService.getDmRoom(roomId).send({ this.wsChatMethodsService.getDmRoom(roomId).send({
file: { file: {
"type": file.type, "type": file.type,
@@ -835,20 +849,33 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}], }],
temporaryData: formData temporaryData: formData
}) })
});
} else {
console.log('File type invalid')
}
} }
blobToBase64 = blob => { getFileReader(): FileReader {
const reader = new FileReader(); const fileReader = new FileReader();
reader.readAsDataURL(blob); const zoneOriginalInstance = (fileReader as any)["__zone_symbol__originalInstance"];
return zoneOriginalInstance || fileReader;
}
getBase64(file) {
var reader = this.getFileReader();
reader.readAsDataURL(file);
return new Promise(resolve => { return new Promise(resolve => {
reader.onloadend = () => { reader.onload = function () {
resolve(reader.result); resolve(reader.result)
};
reader.onerror = function (error) {
console.log('Error: ', error);
}; };
}); });
};
}
bookMeeting() { bookMeeting() {
@@ -946,16 +973,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
msg.downloadFileMsg() msg.downloadFileMsg()
} }
_arrayBufferToBase64( buffer ) {
var binary = '';
var bytes = new Uint8Array( buffer );
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return window.btoa( binary );
}
pdfPreview() { pdfPreview() {
const options: DocumentViewerOptions = { const options: DocumentViewerOptions = {
title: 'My App' title: 'My App'
@@ -967,32 +984,123 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
console.log(msg); console.log(msg);
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') { if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
this.downloadFileMsg(msg) this.downloadFileMsg(msg)
} else {} } else { }
}
b64toBlob(b64Data, contentType) {
contentType = contentType || '';
var sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
var byteCharacters = window.atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
}
viewDocument(file: any, url?: string) {
console.log()
if (file.type == "application/webtrix") {
this.openViewDocumentModal(file);
}
else {
let fullUrl = "https://www.tabularium.pt" + url;
this.fileService.viewDocumentByUrl(fullUrl);
}
}
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, type)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
} }
async openPreview(msg) { async openPreview(msg) {
console.log(msg); console.log(msg);
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') { if(msg.file.type === "application/webtrix") {
this.downloadFileMsg(msg) this.viewDocument(msg.file, msg.attachments.image_url)
} else { } else {
/* if(msg.file.type === "application/pdf") { if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.viewDocument(msg, msg.attachments.image_url) this.downloadFileMsg(msg)
} else { */
const modal = await this.modalController.create({
component: ViewMediaPage, /* } else if (msg.file.type === "application/pdf") {
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url, console.log(str);
type: msg.file.type, const win = window.open("", "_blank");
username: msg.u.name, let html = '';
_updatedAt: msg._updatedAt
html += '<html>';
html += '<body style="margin:0!important">';
html += '<iframe width="100%" height="100%" src="' + str + '" type="application/pdf" />';
html += '</body>';
html += '</html>';
setTimeout(() => {
win.document.write(html);
}, 0); */
//this.viewDocument(msg, msg.attachments.image_url)
} else {
var str = msg.attachments[0].image_url;
str = str.substring(1, ((str.length) - 1));
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.downloadFileFromBrowser(msg.attachments[0].name, str)
} else if (this.platform.is('tablet')) {
this.openFile(str, msg.attachments[0].name, msg.file.type);
} }
});
modal.present();
//}
}
} }
@@ -7,7 +7,7 @@
</div> </div>
<div class="buttons"> <div class="buttons">
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button> <button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
<!-- <button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button> --> <button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button> <button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button> <button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button>
<div class="solid"></div> <div class="solid"></div>
+11
View File
@@ -107,6 +107,17 @@ class SessionService {
return initials; return initials;
} }
get getManagerInitials() {
let names = this._user.FullName.split(' ') || ' ',
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
} }
+3 -4
View File
@@ -22,12 +22,11 @@
export const environment = { export const environment = {
production: false, production: false,
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket',
//apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', //apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
domain: 'gabinetedigital.local', //gabinetedigital.local domain: 'gabinetedigital.local', //gabinetedigital.local
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local