Skip to content

Commit 0864ae1

Browse files
committed
fix fetching protocol from server on Android
1 parent 19a7f43 commit 0864ae1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

config.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<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">
2+
<widget android-versionCode="6415" id="org.codaco.NetworkCanvasInterviewer6" ios-CFBundleIdentifier="org.codaco.networkCanvasInterviewerBusiness" ios-CFBundleVersion="6415" version="6.5.2"
3+
xmlns="http://www.w3.org/ns/widgets"
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:cdv="http://cordova.apache.org/ns/1.0">
36
<name>Network Canvas Interviewer</name>
47
<description>
58
A tool for conducting Network Canvas Interviews.
@@ -38,8 +41,6 @@
3841
</edit-config>
3942
</platform>
4043
<platform name="ios">
41-
<allow-navigation href="*"/>
42-
<allow-navigation href="*"/>
4344
<allow-navigation href="*"/>
4445
<preference name="WKWebViewOnly" value="true"/>
4546
<preference name="Allow3DTouchLinkPreview" value="false"/>
@@ -84,4 +85,4 @@
8485
<plugin name="cordova-plugin-network-information" spec="~2.0.2"/>
8586
<plugin name="cordova-plugin-chooser" spec="~1.3.1"/>
8687
<plugin name="cordova-sqlite-storage" spec="6.0.0"/>
87-
</widget>
88+
</widget>

src/utils/protocol/downloadProtocol.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* global FileTransfer */
33
import uuid from 'uuid/v4';
44
import environments from '../environments';
5-
import inEnvironment from '../Environment';
5+
import inEnvironment, { isIOS } from '../Environment';
66
import { writeFile, tempDataPath } from '../filesystem';
77
import friendlyErrorMessage from '../../utils/friendlyErrorMessage';
88
import ApiClient from '../../utils/ApiClient';
@@ -60,9 +60,12 @@ const downloadProtocol = inEnvironment((environment) => {
6060
let promisedResponse;
6161

6262
if (pairedServer) {
63-
// In cordova, the cordova-plugin-network-canvas-client wants the destination
63+
// on iOS, the cordova-plugin-network-canvas-client wants the destination
6464
// to be a folder, not a file. It assigns a temp filename itself.
65-
const destination = tempDataPath();
65+
//
66+
// however, on android it needs to be a file.
67+
const destination = isIOS() ? tempDataPath() : `${tempDataPath()}${getProtocolName()}`;
68+
6669
promisedResponse = new ApiClient(pairedServer)
6770
// .addTrustedCert() is not required, assuming we've just fetched the protocol list
6871
.downloadProtocol(uri, destination)

0 commit comments

Comments
 (0)