Fix mobile assistant image downloads
Some checks failed
Forgejo Android APK / Build signed APK (push) Has been cancelled
Some checks failed
Forgejo Android APK / Build signed APK (push) Has been cancelled
This commit is contained in:
parent
629dea808e
commit
2cef65fb1f
6 changed files with 35 additions and 15 deletions
|
|
@ -9,8 +9,8 @@ android {
|
|||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
// Version values below are overwritten by scripts/release.sh from
|
||||
// the root package.json. versionCode auto-increments per release.
|
||||
versionCode 714003
|
||||
versionName "7.14.3"
|
||||
versionCode 714007
|
||||
versionName "7.14.7"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
|
|
|
|||
4
mobile/package-lock.json
generated
4
mobile/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pedscribe-mobile",
|
||||
"version": "7.14.3",
|
||||
"version": "7.14.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pedscribe-mobile",
|
||||
"version": "7.14.3",
|
||||
"version": "7.14.7",
|
||||
"dependencies": {
|
||||
"@aparajita/capacitor-biometric-auth": "^8.0.0",
|
||||
"@capacitor/android": "^6.0.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pedscribe-mobile",
|
||||
"version": "7.14.3",
|
||||
"version": "7.14.7",
|
||||
"description": "PedScribe native mobile app — Capacitor wrapper for Pediatric AI Scribe",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pediatric-ai-scribe",
|
||||
"version": "7.14.6",
|
||||
"version": "7.14.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pediatric-ai-scribe",
|
||||
"version": "7.14.6",
|
||||
"version": "7.14.7",
|
||||
"dependencies": {
|
||||
"@marp-team/marp-cli": "^4.3.1",
|
||||
"@marp-team/marp-core": "^4.3.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pediatric-ai-scribe",
|
||||
"version": "7.14.6",
|
||||
"version": "7.14.7",
|
||||
"description": "AI-powered pediatric clinical documentation platform",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -49,13 +49,7 @@ export function createAssistantImageStore() {
|
|||
if (typeof window.showToast === 'function') window.showToast('Image saving is not available in this app build yet. Update the app and try again.', 'error');
|
||||
return;
|
||||
}
|
||||
var a = document.createElement('a');
|
||||
a.href = src;
|
||||
a.download = 'clinical-visual.png';
|
||||
a.rel = 'noopener';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
await downloadWithBrowser(src);
|
||||
} catch (e) {
|
||||
if (typeof window.showToast === 'function') window.showToast(e.message || 'Image download failed', 'error');
|
||||
}
|
||||
|
|
@ -145,6 +139,32 @@ async function shareWithWebFile(src) {
|
|||
} catch (e) { return isShareCancel(e) ? 'cancelled' : 'unavailable'; }
|
||||
}
|
||||
|
||||
async function downloadWithBrowser(src) {
|
||||
var blob = await imageSourceToBlob(src);
|
||||
var objectUrl = URL.createObjectURL(blob);
|
||||
var a = document.createElement('a');
|
||||
a.href = objectUrl;
|
||||
a.download = 'clinical-visual.png';
|
||||
a.rel = 'noopener';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
setTimeout(function() { URL.revokeObjectURL(objectUrl); }, 60000);
|
||||
|
||||
if (isMobileBrowser()) {
|
||||
setTimeout(function() {
|
||||
var opened = window.open(objectUrl, '_blank', 'noopener');
|
||||
if (opened && typeof window.showToast === 'function') {
|
||||
window.showToast('If the download did not start, long-press the opened image and save it.', 'success');
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
function isMobileBrowser() {
|
||||
return !isNativeApp() && /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent || '');
|
||||
}
|
||||
|
||||
function isNativeApp() {
|
||||
return !!(window.Capacitor && (!window.Capacitor.isNativePlatform || window.Capacitor.isNativePlatform()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue