Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Commit 13111ce

Browse files
feat: initial code 🚀
1 parent bad5391 commit 13111ce

File tree

202 files changed

+19787
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+19787
-0
lines changed

.ci/build-android.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -v
2+
3+
set -e
4+
5+
# Pre-build Commands
6+
npm run decrypt-assets
7+
npm run licenses
8+
9+
# Build Ionic App for Android
10+
ionic cordova platform add android --nofetch
11+
ionic cordova build android --prod --release

.ci/package-android.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash -v
2+
3+
set -e
4+
5+
if [[ "$TRAVIS_BRANCH" != "master" ]]
6+
then
7+
echo "Skipping package Android for development branch"
8+
exit
9+
fi
10+
11+
mkdir -p output
12+
cp platforms/android/app/build/outputs/apk/release/app-release.apk output/ibp.apk

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Specifies intentionally untracked files to ignore when using Git
2+
# http://git-scm.com/docs/gitignore
3+
4+
*~
5+
*.sw[mnpcod]
6+
*.log
7+
*.tmp
8+
*.tmp.*
9+
log.txt
10+
*.sublime-project
11+
*.sublime-workspace
12+
.vscode/
13+
npm-debug.log*
14+
.directory
15+
16+
.idea/
17+
.ionic/
18+
.sourcemaps/
19+
.sass-cache/
20+
.tmp/
21+
.versions/
22+
coverage/
23+
www/
24+
node_modules/
25+
tmp/
26+
temp/
27+
platforms/
28+
plugins/
29+
plugins/android.json
30+
plugins/ios.json
31+
$RECYCLE.BIN/
32+
33+
.DS_Store
34+
Thumbs.db
35+
UserInterfaceState.xcuserstate
36+
37+
# Needs to be generated everytime on build system
38+
src/assets/LICENSES.txt
39+
40+
# Encrypted files
41+
.scripts/test.txt
42+
build.json
43+
signing.keystore
44+
src/environments/environment.prod.ts
45+
src/environments/environment.ts

.scripts/config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
options: { algorithm: "aes256" },
3+
files: [
4+
"build.json",
5+
"signing.keystore",
6+
"src/environments/environment.prod.ts",
7+
"src/environments/environment.ts"
8+
],
9+
warning: `🚨 If it's throwing ERR_INVALID_CALLBACK error that means your password is wrong`
10+
};

.scripts/decrypt.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const config = require("./config");
2+
const encryptor = require("file-encryptor");
3+
const envPassword = process.env.IBP_ASSET_DECRYPTION_PASSWORD;
4+
const readline = require("readline").createInterface({
5+
input: process.stdin,
6+
output: process.stdout
7+
});
8+
9+
ibpInit = key => {
10+
const ops = config.files.length;
11+
let cnt = 0;
12+
config.files.forEach(f => {
13+
encryptor.decryptFile(`${f}.enc`, f, key, config.options, function(err) {
14+
cnt++;
15+
console.log(`✔️ Decrypted: ${f}`);
16+
if (cnt === ops) {
17+
console.log(`✨ Gracefully exiting for Travis CI ✨`);
18+
process.exit();
19+
}
20+
});
21+
});
22+
};
23+
24+
if (envPassword) {
25+
ibpInit(envPassword);
26+
} else {
27+
console.log(config.warning);
28+
readline.question(`please enter decryption password: `, key => {
29+
readline.close();
30+
ibpInit(key);
31+
});
32+
}

.scripts/encrypt.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const config = require("./config");
2+
const encryptor = require("file-encryptor");
3+
const readline = require("readline").createInterface({
4+
input: process.stdin,
5+
output: process.stdout
6+
});
7+
8+
console.log(config.warning);
9+
10+
readline.question(`please enter encryption password: `, key => {
11+
readline.close();
12+
checkPassword(key, function(err) {
13+
if (err) {
14+
return;
15+
}
16+
config.files.forEach(f => {
17+
encryptor.encryptFile(f, `${f}.enc`, key, config.options, function(err) {
18+
console.log(`✔️ Encrypted: ${f}`);
19+
});
20+
});
21+
});
22+
});
23+
24+
checkPassword = (key, callback) => {
25+
encryptor.decryptFile(
26+
".scripts/test.txt.enc",
27+
".scripts/test.txt",
28+
key,
29+
config.options,
30+
function(err) {
31+
if (!err) {
32+
callback(!true);
33+
}
34+
}
35+
);
36+
};

.scripts/test.txt.enc

64 Bytes
Binary file not shown.

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
branches:
2+
only:
3+
- master
4+
5+
language: android
6+
7+
android:
8+
components:
9+
# Latest revision of Android SDK Tools
10+
- tools
11+
- platform-tools
12+
13+
# The BuildTools version used by your project
14+
- build-tools-27.0.1
15+
16+
# The SDK version used to compile your project
17+
- android-27
18+
19+
# Additional components
20+
- extra-google-google_play_services
21+
- extra-google-m2repository
22+
- extra-android-m2repository
23+
24+
before_install:
25+
- wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
26+
- nvm install node
27+
- node --version
28+
- npm install -g ionic cordova
29+
30+
script:
31+
- npm install
32+
- ./.ci/build-android.sh && ./.ci/package-android.sh
33+
34+
deploy:
35+
provider: releases
36+
api_key: $AUTH_TOKEN
37+
file: output/ibp.apk
38+
skip_cleanup: true
39+
overwrite: true

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Biodiversity Mobile
2+
3+
This is a reposotory for the mobile app associated with the biodiversity informatics platform.
4+
5+
[![IBP on Google Play](https://play.google.com/intl/en_us/badges/images/badge_new.png)](http://play.google.com/store/apps/details?id=com.mobisys.android.ibp)
6+
7+
![Build Status on Travis CI](https://api.travis-ci.org/strandls/biodiv-mobile.svg?branch=master)
8+
9+
## 🔧 Prerequisites
10+
11+
1. Install [Node.js](https://nodejs.org/)
12+
2. Setup android development environment
13+
14+
## 🚀 Quick start
15+
16+
```sh
17+
git clone https://github.com/strandls/biodiv-mobile # Clone Repository
18+
npm install -g ionic cordova # Install Ionic and Cordova Globally
19+
npm install # Install Dependencies
20+
npm run decrypt-assets
21+
# Abobe command is required for IBP Mobile development only
22+
# to decrypt config and signing assets locally
23+
# otherwise modify `src/environments/environment.sample.ts`
24+
# and create `build.json` if you want automatic signing for more see https://bit.ly/2VEABgE
25+
ionic serve # Start development environment
26+
```
27+
28+
## 🚢 Building
29+
30+
```sh
31+
ionic cordova build android/ios # add --prod --release flag for building production apk
32+
```

0 commit comments

Comments
 (0)