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: Add CapacitorJS #926

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
82acbb1
chore: setup capacitor for android and document how to use it
branch14 May 31, 2022
dde9489
fix: link to custom-id
branch14 May 31, 2022
e737578
doc: improve formatting
branch14 May 31, 2022
130d9a5
fix: typo
branch14 May 31, 2022
8b0b1cc
Merge branch 'develop' into feat/setup-capacitor-for-android
munen Jun 2, 2022
ee3f031
Merge pull request #805 from 200ok-ch/feat/setup-capacitor-for-android
munen Jun 2, 2022
0edc961
chore: set server hostname and androidScheme
branch14 Jun 2, 2022
24ead2d
feat: login to gitlab works, dropbox maybe
branch14 Jun 8, 2022
0748f41
chore: cleanup
branch14 Jun 8, 2022
744b86d
feat: switch gitlab redirectUrl based on platform
branch14 Jun 8, 2022
e3b4d72
feat: Quasi Login to Dropbox
munen Jun 8, 2022
187ae94
doc: Rationale for passing OAuth parameters (query or hash)
munen Jun 8, 2022
4d4b8ce
feat: dynamic redirect for dropbox based on platform
branch14 Jun 8, 2022
82287a3
Merge branch 'feat/login-to-gitlab-from-native-app' of github.com:200…
branch14 Jun 8, 2022
135c86e
chore: fix linting errors
branch14 Jun 9, 2022
c512e3a
chore: add missing colon
branch14 Jun 9, 2022
365a648
Merge pull request #822 from 200ok-ch/feat/login-to-gitlab-from-nativ…
munen Jun 9, 2022
e9c12b4
feat: login to webdav from native app
branch14 Jun 9, 2022
858e646
chore: make it prettier
branch14 Jun 9, 2022
f62f338
Merge pull request #826 from 200ok-ch/feat/login-to-webdav-from-nativ…
munen Jun 9, 2022
f1ca8e1
chore: install capacitor plugin send-intent
branch14 Jun 9, 2022
915c604
feat: receive send intent
branch14 Jun 13, 2022
3a565ac
fix: formatting
branch14 Jun 13, 2022
5d7b9ad
fix: formatting
branch14 Jun 13, 2022
1c598e5
chore: minimal fastlane setup for android
branch14 Jun 13, 2022
0d7b420
chore: rename app id
branch14 Jun 13, 2022
2b31e2b
Merge pull request #830 from 200ok-ch/feat/organice-as-android-share-…
munen Jun 15, 2022
2a45c51
chore: For the moment, disable sharing on Android
munen Jun 15, 2022
2446278
Merge pull request #839 from 200ok-ch/feat/minimal-fastlane-setup-for…
munen Jun 15, 2022
034ddaa
Merge pull request #840 from 200ok-ch/chore/rename-app-id
munen Jun 15, 2022
3aedc7d
chore: remove google's initial hash for less merge conflicts
branch14 Jun 16, 2022
004ab00
Merge branch 'master' into develop
branch14 Jun 16, 2022
c7374a2
Merge branch 'develop' of github.com:200ok-ch/organice into develop
branch14 Jun 16, 2022
6461103
Merge branch 'master' into develop
branch14 Jun 16, 2022
9718f4a
feat: show a build number on the sign in screen
branch14 Jun 20, 2022
873e3db
Merge branch 'master' into develop
branch14 Jun 20, 2022
3e05b9f
Merge branch 'develop' into feat/show-a-build-number
branch14 Jun 20, 2022
061b4a1
fix: className instead of class
branch14 Jun 20, 2022
50680ef
fix: formatting
branch14 Jun 20, 2022
747c3a7
Merge branch 'develop' into feat/show-a-build-number
branch14 Jun 20, 2022
9d07569
fix: formatting
branch14 Jun 20, 2022
eee1b62
chore: Rename ORGANICE_REVISION to ORGANICE_ROLLING_RELEASE
munen Jun 20, 2022
9b471b4
Merge pull request #849 from 200ok-ch/feat/show-a-build-number
munen Jun 20, 2022
67b0fb7
feat: deploy via make with revision
branch14 Jun 21, 2022
a2cd8f0
refactor: make workflow for fewer phony targets
branch14 Jun 21, 2022
43ce06b
chore: Makefile cleanup
branch14 Jun 21, 2022
5b6504b
fix: iOS top bar for PWA
munen Jun 21, 2022
ed38d43
Merge pull request #855 from 200ok-ch/fix/ios-top-bar
munen Jun 21, 2022
8261dfd
Revert "fix: iOS top bar for PWA"
munen Jun 21, 2022
c8cb64f
Merge branch 'master' into develop
branch14 Jun 22, 2022
7140fef
fix: make sure src/lib/headline_filter_parser.js is generated
branch14 Jun 22, 2022
cd66678
Merge pull request #852 from 200ok-ch/feat/deploy-via-make-with-revision
munen Jun 22, 2022
2a3478b
fix: terminate lftp after upload
branch14 Jun 28, 2022
7886d70
Merge pull request #863 from 200ok-ch/fix/terminate-lftp-after-upload
munen Jun 28, 2022
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
command: sudo apt-get update -yq && sudo apt install -yq lftp pandoc gvfs emacs
- run:
name: Deploy to https://staging.organice.200ok.ch
command: 'FTP_USER=${FTP_USER_STAGE} FTP_PASSWD=${FTP_PASSWD_STAGE} ./bin/compile_and_upload.sh'
command: 'FTP_USER=${FTP_USER_STAGE} FTP_PASSWD=${FTP_PASSWD_STAGE} make deploy'
- run:
name: Deploy documentation to https://staging.organice.200ok.ch/documentation.html
command: 'FTP_USER=${FTP_USER_STAGE} FTP_PASSWD=${FTP_PASSWD_STAGE} ./bin/compile_doc_and_upload.sh'
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
release/
node_modules/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ yarn-error.log*
/documentation.org

.eslintcache
/local.mk
/release
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
release/
node_modules/
90 changes: 81 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,98 @@
SHELL = /bin/bash
# ------------------------------------------------------------
# includes

-include .ok/credentials.mk
-include local.mk

# ------------------------------------------------------------
# variables

ANDROID_TARGET?=Pixel_3_API_32

SHELL:=/bin/bash

REVISION=$(shell git describe --tags)

RELEASE_FILES=$(shell find release/ -type f -name '*.js')

# ------------------------------------------------------------
# functions

.DEFAULT_GOAL = run
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))

# ------------------------------------------------------------
# dev

.PHONY: help
help: ## Show this help (default)
@egrep -h '\s##\s' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'

# This is likely the only case in which make should call yarn.
.PHONY: setup
setup:
setup: ## Setup the project
yarn install --production=false
make src/lib/headline_filter_parser.js

.PHONY: run
run: setup
yarn start
.PHONY: start
start: setup src
start: ## Run a server that serves organice as PWA
npx react-scripts start

.PHONY: test
test: setup
yarn test
test: setup src
test: ## Run the tests
npx react-scripts test --env=jsdom

.PHONY: docs
docs:
docs: ## Compile the documentation
./bin/compile_doc.sh

.PHONY: deploy-docs
deploy-docs: docs
deploy-docs: ## Deploy the documentation
./bin/compile_doc_and_upload.sh

build: setup src
build: ## Build a production (pre-)build
bin/transient_env_vars.sh bait
npx react-scripts build

release: build
release: ## Build a release (with proper credentials and build number)
bin/transient_env_vars.sh switch build release
make set-revision

.PHONY: set-revision
set-revision: $(RELEASE_FILES)
set-revision: ## Set the build revision
for FILE in $?; do sed -i "s/ORGANICE_ROLLING_RELEASE/$(REVISION)/" $$FILE; done

.PHONY: android
android: release
android: ## Build the android app and run it on $ANDROID_TARGET
npx cap run android --target $(ANDROID_TARGET)

.PHONY: check-ftp-credentials
check-ftp-credentials: ## Check for FTP credentials
$(call check_defined, FTP_HOST, deployment target)
$(call check_defined, FTP_USER, deployment user)
$(call check_defined, FTP_PASSWD, deployment password)

.PHONY: deploy
deploy: check-ftp-credentials setup release
deploy: ## Deploy organice as PWA via FTP
cd release && \
lftp -u${FTP_USER},${FTP_PASSWD} -e "mirror -R ./; bye" ${FTP_HOST}

# ------------------------------------------------------------
# internals

src/lib/headline_filter_parser.js: src/lib/headline_filter_parser.grammar.pegjs
echo '/* eslint-disable */' > $@
npx pegjs -o - $< >> $@
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: serve build
web: serve release
46 changes: 43 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,19 @@ you can manually generate it with:
./bin/compile_search_parser.sh
#+END_SRC

** Testing
** User Acceptance Testing

When you're developing a new feature and you want to manually test it,
it's best to check it out in a Desktop browser and on your smartphone.
This is how you do that:

*** Desktop
*** PWA on Desktop

Run the application with =yarn start= which will open organice in your
configured default browser. Alternatively, visit
=http://localhost:3000= in the browser of your choice.

*** Smartphone
*** PWA on Smartphone

There are multiple options on how you can connect from your smartphone
to your computer running organice.
Expand Down Expand Up @@ -528,6 +528,43 @@ ssh -L 3000:localhost:3000 user-dev-machine
If you don't have a shell on your phone, you can use a dedicated SSH
application (like [[https://www.termius.com/][Terminus]]).

*** Native app on Android

- Install [[https://developer.android.com/studio#downloads][Android Studio]]
- Follow the [[https://capacitorjs.com/docs/getting-started/environment-setup#android-sdk][Capacitor Guide to setup an Android SDK]]

#+begin_quote
/:warning:/ Make sure to install the required subpackages. Activate
"Show Package Details" to reveal hidden subpackages.

At time of writing "Android API 32" does not automatically install the
subpackages "Google APIs Intel x86 Atom_64 System Image" and "Google
Play Intel x86 Atom_64 System Image", which are both required to run
the Emulator on an Intel based machine.

[[https://raw.githubusercontent.com/200ok-ch/organice/master/images/api_32.png]]
#+end_quote

- Create a device in Android Studio by running any app

#+begin_quote
/:monocle_face:/ Theoretically this should not be nescessary, as
Capacitor should be able to create a device to deploy the app to on
the fly. But this didn't work for me. After the device had be run once
by Android Studio, Capacitor was able to start it on its own.
#+end_quote

- Shut down Android Studio and any running Emulator
- Before run organice as a native app you need to =yarn build= it
- Run organice in the Emulater with =npx cap run android=

*** TODO Native app on iOS

#+begin_quote
/:sparkles:/ This is brand new section that wants to be written.
Please check out how to [[#contributions][contribute to organice]].
#+end_quote

** Debugging Tests

Apart from the popular choice of =console.log=-debugging, it's easy to
Expand Down Expand Up @@ -575,6 +612,9 @@ merging a pull request to =develop=, code and documentation are
automatically deployed to stage.

** Contributions
:PROPERTIES:
:CUSTOM_ID: contributions
:END:

Please see our [[https://github.com/200ok-ch/organice/blob/master/CONTRIBUTING.org][contributor guidelines]] and our [[https://github.com/200ok-ch/organice/blob/master/CODE_OF_CONDUCT.md][code of conduct]].

Expand Down
96 changes: 96 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore

# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof

# Cordova plugins for Capacitor
capacitor-cordova-android-plugins

# Copied web assets
app/src/main/assets/public
3 changes: 3 additions & 0 deletions android/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
Loading