Skip to content

Commit

Permalink
fix fetching protocol from server on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jthrilly committed Dec 5, 2023
1 parent 19a7f43 commit 0864ae1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget android-versionCode="6413" id="org.codaco.NetworkCanvasInterviewer6" ios-CFBundleIdentifier="org.codaco.networkCanvasInterviewerBusiness" ios-CFBundleVersion="6413" version="6.5.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="6415" id="org.codaco.NetworkCanvasInterviewer6" ios-CFBundleIdentifier="org.codaco.networkCanvasInterviewerBusiness" ios-CFBundleVersion="6415" version="6.5.2"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Network Canvas Interviewer</name>
<description>
A tool for conducting Network Canvas Interviews.
Expand Down Expand Up @@ -38,8 +41,6 @@
</edit-config>
</platform>
<platform name="ios">
<allow-navigation href="*"/>
<allow-navigation href="*"/>
<allow-navigation href="*"/>
<preference name="WKWebViewOnly" value="true"/>
<preference name="Allow3DTouchLinkPreview" value="false"/>
Expand Down Expand Up @@ -84,4 +85,4 @@
<plugin name="cordova-plugin-network-information" spec="~2.0.2"/>
<plugin name="cordova-plugin-chooser" spec="~1.3.1"/>
<plugin name="cordova-sqlite-storage" spec="6.0.0"/>
</widget>
</widget>
9 changes: 6 additions & 3 deletions src/utils/protocol/downloadProtocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global FileTransfer */
import uuid from 'uuid/v4';
import environments from '../environments';
import inEnvironment from '../Environment';
import inEnvironment, { isIOS } from '../Environment';
import { writeFile, tempDataPath } from '../filesystem';
import friendlyErrorMessage from '../../utils/friendlyErrorMessage';
import ApiClient from '../../utils/ApiClient';
Expand Down Expand Up @@ -60,9 +60,12 @@ const downloadProtocol = inEnvironment((environment) => {
let promisedResponse;

if (pairedServer) {
// In cordova, the cordova-plugin-network-canvas-client wants the destination
// on iOS, 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();
//
// however, on android it needs to be a file.
const destination = isIOS() ? tempDataPath() : `${tempDataPath()}${getProtocolName()}`;

promisedResponse = new ApiClient(pairedServer)
// .addTrustedCert() is not required, assuming we've just fetched the protocol list
.downloadProtocol(uri, destination)
Expand Down

0 comments on commit 0864ae1

Please sign in to comment.