diff --git a/config.xml b/config.xml index cb0aa853a..27b35a344 100644 --- a/config.xml +++ b/config.xml @@ -1,8 +1,5 @@ - + Network Canvas Interviewer A tool for conducting Network Canvas Interviews. @@ -10,7 +7,7 @@ Complex Data Collective - + @@ -19,6 +16,7 @@ + @@ -40,6 +38,7 @@ + @@ -68,7 +67,6 @@ - @@ -86,4 +84,4 @@ - + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c51723824..613a0b495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -157,11 +157,6 @@ "npm": "8.19.4" } }, - "../cordova-plugin-network-canvas-client": { - "version": "0.0.2", - "extraneous": true, - "license": "GPL-3.0-or-later" - }, "node_modules/@ampproject/remapping": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.1.2.tgz", @@ -9985,7 +9980,7 @@ }, "node_modules/cordova-plugin-network-canvas-client": { "version": "0.0.2", - "resolved": "git+ssh://git@github.com/complexdatacollective/cordova-plugin-network-canvas-client.git#4bf75df4d6bf975a26d85ce2db02c23541b7e6aa", + "resolved": "git+ssh://git@github.com/complexdatacollective/cordova-plugin-network-canvas-client.git#364662b79e1a97ac88ec0b0e520e497e810b1f0f", "dev": true, "license": "GPL-3.0-or-later" }, @@ -43800,9 +43795,9 @@ "from": "cordova-plugin-ionic-keyboard@github:ionic-team/cordova-plugin-ionic-keyboard" }, "cordova-plugin-network-canvas-client": { - "version": "git+ssh://git@github.com/complexdatacollective/cordova-plugin-network-canvas-client.git#4bf75df4d6bf975a26d85ce2db02c23541b7e6aa", + "version": "git+ssh://git@github.com/complexdatacollective/cordova-plugin-network-canvas-client.git#364662b79e1a97ac88ec0b0e520e497e810b1f0f", "dev": true, - "from": "cordova-plugin-network-canvas-client@github:complexdatacollective/cordova-plugin-network-canvas-client" + "from": "cordova-plugin-network-canvas-client@https://github.com/complexdatacollective/cordova-plugin-network-canvas-client.git" }, "core-js": { "version": "3.21.1", diff --git a/package.json b/package.json index 9681b08a6..180f8e3bc 100644 --- a/package.json +++ b/package.json @@ -315,4 +315,4 @@ "cordova-plugin-ionic-keyboard": {} } } -} +} \ No newline at end of file diff --git a/src/utils/protocol/downloadProtocol.js b/src/utils/protocol/downloadProtocol.js index c38c72617..fc6dcb66b 100644 --- a/src/utils/protocol/downloadProtocol.js +++ b/src/utils/protocol/downloadProtocol.js @@ -36,8 +36,8 @@ const downloadProtocol = inEnvironment((environment) => { if (environment === environments.ELECTRON) { const request = require('request-promise-native'); const destination = path.join(tempDataPath(), getProtocolName()); - return (uri, pairedServer = false) => { + let promisedResponse; if (pairedServer) { promisedResponse = new ApiClient(pairedServer).downloadProtocol(uri); @@ -56,29 +56,38 @@ const downloadProtocol = inEnvironment((environment) => { } if (environment === environments.CORDOVA) { - const destination = `${tempDataPath()}${getProtocolName()}` return (uri, pairedServer) => { let promisedResponse; + if (pairedServer) { + // In cordova, the cordova-plugin-network-canvas-client wants the destination + // to be a folder, not a file. It assigns a temp filename itself. + const destination = tempDataPath(); promisedResponse = new ApiClient(pairedServer) // .addTrustedCert() is not required, assuming we've just fetched the protocol list .downloadProtocol(uri, destination) - .then(() => destination); + .then((result) => { + // Result is a FileEntry object + return result.nativeURL; + }) } else { promisedResponse = getURL(uri) .then(url => url.href) .catch(urlError) .then(href => new Promise((resolve, reject) => { + // The filetransfer plugin requires a folder to write to + const destinationWithFolder = `${tempDataPath()}${getProtocolName()}`; + const fileTransfer = new FileTransfer(); - console.log('fileTransfer', destination); fileTransfer.download( href, - destination, - () => resolve(destination), + destinationWithFolder, + () => resolve(destinationWithFolder), error => reject(error), ); })); } + return promisedResponse .catch((error) => { const getErrorMessage = ({ code }) => {