Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bee9361c1d |
6 changed files with 81 additions and 14 deletions
|
|
@ -9,8 +9,8 @@ android {
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
// Version values below are overwritten by scripts/release.sh from
|
// Version values below are overwritten by scripts/release.sh from
|
||||||
// the root package.json. versionCode auto-increments per release.
|
// the root package.json. versionCode auto-increments per release.
|
||||||
versionCode 714013
|
versionCode 714014
|
||||||
versionName "7.14.13"
|
versionName "7.14.14"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
// 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",
|
"name": "pedscribe-mobile",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pedscribe-mobile",
|
"name": "pedscribe-mobile",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aparajita/capacitor-biometric-auth": "^8.0.0",
|
"@aparajita/capacitor-biometric-auth": "^8.0.0",
|
||||||
"@capacitor/android": "^6.0.0",
|
"@capacitor/android": "^6.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "pedscribe-mobile",
|
"name": "pedscribe-mobile",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"description": "PedScribe native mobile app — Capacitor wrapper for Pediatric AI Scribe",
|
"description": "PedScribe native mobile app — Capacitor wrapper for Pediatric AI Scribe",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "pediatric-ai-scribe",
|
"name": "pediatric-ai-scribe",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pediatric-ai-scribe",
|
"name": "pediatric-ai-scribe",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@marp-team/marp-cli": "^4.3.1",
|
"@marp-team/marp-cli": "^4.3.1",
|
||||||
"@marp-team/marp-core": "^4.3.0",
|
"@marp-team/marp-core": "^4.3.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "pediatric-ai-scribe",
|
"name": "pediatric-ai-scribe",
|
||||||
"version": "7.14.13",
|
"version": "7.14.14",
|
||||||
"description": "AI-powered pediatric clinical documentation platform",
|
"description": "AI-powered pediatric clinical documentation platform",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ export function createAssistantImageStore() {
|
||||||
var downloadUrl = item && item.downloadUrl;
|
var downloadUrl = item && item.downloadUrl;
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
try {
|
try {
|
||||||
if (await saveWithNativeShare(src)) return;
|
|
||||||
if (downloadUrl) {
|
if (downloadUrl) {
|
||||||
downloadFromServer(downloadUrl);
|
await downloadFromServer(downloadUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (await saveWithNativeShare(src)) return;
|
||||||
if (isNativeApp()) {
|
if (isNativeApp()) {
|
||||||
if (typeof window.showToast === 'function') window.showToast('Image saving is not available in this app build yet. Update the app and try again.', 'error');
|
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;
|
return;
|
||||||
|
|
@ -147,7 +147,7 @@ async function shareWithWebFile(src) {
|
||||||
if (!navigator.canShare({ files: [file] })) return 'unavailable';
|
if (!navigator.canShare({ files: [file] })) return 'unavailable';
|
||||||
await navigator.share({ files: [file], title: 'Clinical visual', text: 'Clinical Assistant generated visual' });
|
await navigator.share({ files: [file], title: 'Clinical visual', text: 'Clinical Assistant generated visual' });
|
||||||
return 'shared';
|
return 'shared';
|
||||||
} catch (e) { return isShareCancel(e) ? 'cancelled' : 'unavailable'; }
|
} catch (e) { return isShareCancel(e) ? 'unavailable' : 'unavailable'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadWithBrowser(src) {
|
async function downloadWithBrowser(src) {
|
||||||
|
|
@ -167,14 +167,77 @@ async function downloadWithBrowser(src) {
|
||||||
setTimeout(function() { URL.revokeObjectURL(objectUrl); }, 60000);
|
setTimeout(function() { URL.revokeObjectURL(objectUrl); }, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadFromServer(url) {
|
async function downloadFromServer(url) {
|
||||||
|
var response = await fetch(url, { headers: authHeadersForDownload(), credentials: 'same-origin' });
|
||||||
|
if (!response.ok) throw new Error('Image download failed');
|
||||||
|
var blob = await response.blob();
|
||||||
|
var name = 'clinical-visual-' + new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19) + '.png';
|
||||||
|
if (await saveBlobWithNativeImageBridge(blob, name)) return;
|
||||||
|
if (await saveBlobWithCapacitorShare(blob, name)) return;
|
||||||
|
if (await shareBlobWithWebFile(blob, name)) return;
|
||||||
|
if (isMobileBrowser()) {
|
||||||
|
if (typeof window.showToast === 'function') window.showToast('Could not start download here. Use Preview and long-press the image to save it.', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
downloadBlobWithAnchor(blob, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
function authHeadersForDownload() {
|
||||||
|
var headers = window.getAuthHeaders ? window.getAuthHeaders() : {};
|
||||||
|
var clean = {};
|
||||||
|
Object.keys(headers || {}).forEach(function(key) {
|
||||||
|
if (key.toLowerCase() !== 'content-type') clean[key] = headers[key];
|
||||||
|
});
|
||||||
|
return clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveBlobWithNativeImageBridge(blob, name) {
|
||||||
|
if (!window.NativeFiles || typeof window.NativeFiles.saveImage !== 'function') return false;
|
||||||
|
try {
|
||||||
|
var base64 = await blobToBase64(blob);
|
||||||
|
var result = String(window.NativeFiles.saveImage(name, base64) || '');
|
||||||
|
if (result.indexOf('saved:') === 0) {
|
||||||
|
if (typeof window.showToast === 'function') window.showToast('Image saved to Photos', 'success');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveBlobWithCapacitorShare(blob, name) {
|
||||||
|
var plugins = window.Capacitor && window.Capacitor.Plugins ? window.Capacitor.Plugins : null;
|
||||||
|
if (!plugins || !plugins.Filesystem) return false;
|
||||||
|
try {
|
||||||
|
var base64 = await blobToBase64(blob);
|
||||||
|
var saved = await plugins.Filesystem.writeFile({ path: name, data: base64, directory: 'CACHE' });
|
||||||
|
if (plugins.Share && saved && saved.uri) {
|
||||||
|
await plugins.Share.share({ title: 'Clinical visual', text: 'Clinical Assistant generated visual', url: saved.uri, dialogTitle: 'Save or share clinical visual' });
|
||||||
|
}
|
||||||
|
if (typeof window.showToast === 'function') window.showToast('Image prepared', 'success');
|
||||||
|
return true;
|
||||||
|
} catch (e) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function shareBlobWithWebFile(blob, name) {
|
||||||
|
if (!navigator.share || !navigator.canShare || typeof File === 'undefined') return false;
|
||||||
|
try {
|
||||||
|
var file = new File([blob], name, { type: blob.type || 'image/png' });
|
||||||
|
if (!navigator.canShare({ files: [file] })) return false;
|
||||||
|
await navigator.share({ files: [file], title: 'Clinical visual', text: 'Clinical Assistant generated visual' });
|
||||||
|
return true;
|
||||||
|
} catch (e) { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadBlobWithAnchor(blob, name) {
|
||||||
|
var objectUrl = URL.createObjectURL(blob);
|
||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = objectUrl;
|
||||||
a.download = 'clinical-visual.png';
|
a.download = name;
|
||||||
a.rel = 'noopener';
|
a.rel = 'noopener';
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
a.remove();
|
a.remove();
|
||||||
|
setTimeout(function() { URL.revokeObjectURL(objectUrl); }, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMobileBrowser() {
|
function isMobileBrowser() {
|
||||||
|
|
@ -193,6 +256,10 @@ function isShareCancel(error) {
|
||||||
async function imageSourceToBase64(src) {
|
async function imageSourceToBase64(src) {
|
||||||
if (/^data:image\//i.test(src)) return src.split(',')[1] || '';
|
if (/^data:image\//i.test(src)) return src.split(',')[1] || '';
|
||||||
var blob = await imageSourceToBlob(src);
|
var blob = await imageSourceToBlob(src);
|
||||||
|
return blobToBase64(blob);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function blobToBase64(blob) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function() { resolve(String(reader.result || '').split(',')[1] || ''); };
|
reader.onload = function() { resolve(String(reader.result || '').split(',')[1] || ''); };
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue