Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/in app survey results #505

Open
wants to merge 16 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ releases
*.jks

.sentryclirc
components.d.ts
components.d.ts
*.crt
*.key
logcat.log
38 changes: 38 additions & 0 deletions build/make-certs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// npx mkcert create-ca && npx mkcert create-cert && mv ./ca.crt ./res/raw/dev_ca.crt && rm -f ./ca.key
import { createCA, createCert } from 'mkcert'
import * as devData from '../config/config-xml.dev'
import { promises as fs } from 'fs'

async function run () {
const caOpts = {
organization: 'Trellis',
countryCode: 'US',
state: 'Connecticut',
locality: 'New Haven',
validity: 365,
}
console.log('Creating CA', caOpts)
const ca = await createCA(caOpts)

const apiOrigin = new URL(devData.API_ORIGIN)

const certOpts = {
ca,
domains: ['localhost', apiOrigin.hostname],
validity: 365,
}
console.log('Creating cert', certOpts)
const cert = await createCert(certOpts)

await fs.writeFile('dev_ca.crt', ca.cert, 'utf8')
await fs.writeFile('dev_cert.crt', cert.cert, 'utf8')
await fs.writeFile('dev_cert.key', cert.key, 'utf8')

await fs.rename('dev_ca.crt', 'res/raw/dev_ca.crt')
await fs.copyFile('dev_cert.crt', '../docker/nginx/ssl/cert.crt')
await fs.copyFile('dev_cert.key', '../docker/nginx/ssl/cert.key')

console.log('Done!')
}

run().catch(console.error)
12 changes: 11 additions & 1 deletion build/webpack.mobile.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function mobileOnly (req, res, next) {

const isProd = process.env.NODE_ENV === 'production'
console.log('isProd', isProd, process.env.NODE_ENV, process.env.APP_ENV)
module.exports = webpackMerge({
const mobileConfig = webpackMerge({
resolve: {
extensions: [
'.mobile.ts',
Expand Down Expand Up @@ -53,3 +53,13 @@ module.exports = webpackMerge({
}),
],
}, config)

if (!isProd) {
mobileConfig.devServer.https = {
key: path.resolve(__dirname, '../dev_cert.key'),
cert: path.resolve(__dirname, '../dev_cert.crt'),
ca: path.resolve(__dirname, '../res/cert/dev_ca.crt'),
}
}

module.exports = mobileConfig
13 changes: 12 additions & 1 deletion build/webpack.web.conf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const webpackMerge = require('webpack-merge')
const config = require('./webpack.base.conf')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')

const isProd = process.env.NODE_ENV === 'production'
module.exports = webpackMerge({
const webConfig = webpackMerge({
resolve: {
extensions: [
'.web.ts',
Expand All @@ -24,3 +25,13 @@ module.exports = webpackMerge({
}),
],
}, config)

if (!isProd) {
webConfig.devServer.https = {
key: path.resolve(__dirname, '../dev_cert.key'),
cert: path.resolve(__dirname, '../dev_cert.crt'),
ca: path.resolve(__dirname, '../res/cert/dev_ca.crt'),
}
}

module.exports = webConfig
17 changes: 17 additions & 0 deletions config/android/app/network_security_config.dev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<!-- Trust preinstalled CAs -->
<certificates src="system" />
<!-- Additionally trust user added CAs -->
<certificates src="user" />
<!-- Dev server certificates -->
<certificates src="@raw/dev_ca" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain>localhost</domain>
<domain includeSubdomains="true">192.168.0.48</domain>
</domain-config>
</network-security-config>
1 change: 0 additions & 1 deletion config/android/app/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain>localhost</domain>
<domain includeSubdomains="true">192.168.0.48</domain>
</domain-config>
</network-security-config>
1 change: 1 addition & 0 deletions config/config-xml.dev.default.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
CONTENT_SOURCE: 'index.html',
API_ORIGIN: 'https://192.168.0.48:9443',
VERSION: require('../package.json').version,
ACCESS_ORIGIN: '*',
DEV: true
Expand Down
10 changes: 6 additions & 4 deletions cordova-clean.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cordova plugin rm cordova-plugin-device
cordova plugin rm cordova-plugin-camera
cordova plugin rm cordova-plugin-file
cordova plugin rm cordova-plugin-file-md5
cordova plugin rm cordova-plugin-zip
cordova plugin rm cordova-plugin-splashscreen
Expand All @@ -10,6 +9,8 @@ cordova plugin rm cordova-plugin-file-transfer
cordova plugin rm cordova-plugin-geolocation
cordova plugin rm cordova-plugin-zeep
cordova plugin rm phonegap-plugin-barcodescanner
cordova plugin rm cordova-plugin-media-capture
cordova plugin rm cordova-plugin-file
cordova plugin rm cordova-plugin-google-nearby-connections

cordova platform rm android
Expand All @@ -21,14 +22,15 @@ cordova platform add android@11

cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-camera
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-file@7
cordova plugin add cordova-plugin-file-md5
cordova plugin add cordova-plugin-zip
cordova plugin add cordova-plugin-splashscreen
cordova plugin add cordova-plugin-whitelist
# cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-sqlite-storage
cordova plugin add cordova-plugin-file-transfer
cordova plugin add https://github.com/apache/cordova-plugin-file-transfer#5c29f9a0e1b0cddb9c0cdf7b79139ae8e523e5c1
cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-zeep
cordova plugin add @red-mobile/cordova-plugin-barcodescanner
cordova plugin add https://github.com/human-nature-lab/cordova-plugin-google-nearby-connections.git
cordova plugin add cordova-plugin-media-capture
7 changes: 5 additions & 2 deletions cordova-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cordova platform add android@11

cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-camera
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-file@6
cordova plugin add cordova-plugin-file-md5
cordova plugin add cordova-plugin-zip
# cordova plugin add cordova-plugin-splashscreen
Expand All @@ -13,4 +13,7 @@ cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-zeep
cordova plugin add @red-mobile/cordova-plugin-barcodescanner
cordova plugin add https://github.com/human-nature-lab/cordova-plugin-google-nearby-connections.git
cordova plugin add https://github.com/apache/cordova-plugin-file-transfer#5c29f9a0e1b0cddb9c0cdf7b79139ae8e523e5c1
cordova plugin add https://github.com/apache/cordova-plugin-file-transfer#5c29f9a0e1b0cddb9c0cdf7b79139ae8e523e5c1
# cordova plugin add cordova-plugin-file-transfer@2
cordova plugin add cordova-plugin-media-capture --force
cordova plugin add cordova-plugin-media@6 --force
3 changes: 2 additions & 1 deletion index.webpack.dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="icon" type="image/png" sizes="96x96" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-16x16.png">
<link rel="stylesheet" href="loader.css">
<!--[if IE]><link rel="shortcut icon" href="/static/img/icons/favicon.ico"><![endif]-->
<!-- Add to home screen for Android and modern mobile browsers -->
<link rel="manifest" href="<%= htmlWebpackPlugin.files.publicPath %>static/manifest.json">
Expand All @@ -34,7 +35,7 @@
Trellis doesn't seem to work with this browser. Please use a browser that supports JavaScript.
</noscript>
<div id="app">
Trellis is loading...
<div class="init-loading"><div class="init-loader"></div></div>
</div>

<script type="text/javascript" src="cordova.js"></script>
Expand Down
3 changes: 2 additions & 1 deletion index.webpack.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="icon" type="image/png" sizes="96x96" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%= htmlWebpackPlugin.files.publicPath %>static/img/icons/favicon-16x16.png">
<link rel="stylesheet" href="loader.css">
<!--[if IE]><link rel="shortcut icon" href="/static/img/icons/favicon.ico"><![endif]-->
<!-- Add to home screen for Android and modern mobile browsers -->
<link rel="manifest" href="<%= htmlWebpackPlugin.files.publicPath %>static/manifest.json">
Expand All @@ -30,7 +31,7 @@
Trellis doesn't seem to work with this browser. Please use a browser that supports JavaScript.
</noscript>
<div id="app">
Trellis is loading...
<div class="loading"><div class="loader"></div></div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="config.js"></script>
Expand Down
Loading