mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-06 07:30:40 +00:00
Fix android app build/auth
We had to backtrack from the latest release of the android app, which is not compatible with the mobile api v0.5 available in Hawthorn. This should change in ironwood. Also, we included the correct oauth client ID in the app, which prevented communication with the LMS. The android app is now out of beta \o/ Close #89
This commit is contained in:
parent
6a5527458f
commit
1e2166dacf
@ -55,6 +55,7 @@ But there's a lot more to Tutor than that! For more advanced usage, please refer
|
||||
dev
|
||||
k8s
|
||||
webui
|
||||
mobile
|
||||
troubleshooting
|
||||
tutor
|
||||
faq
|
||||
|
34
docs/mobile.rst
Normal file
34
docs/mobile.rst
Normal file
@ -0,0 +1,34 @@
|
||||
.. _mobile:
|
||||
|
||||
Mobile Android application
|
||||
==========================
|
||||
|
||||
With Tutor, you can build an Android mobile application for your platform. First, generate the required environment::
|
||||
|
||||
tutor android env
|
||||
|
||||
Then, build the app in debug mode::
|
||||
|
||||
tutor android build debug
|
||||
|
||||
The ``.apk`` file will then be available in ``$TUTOR_ROOT/data/android``. Transfer it to an Android phone to install the application. You should be able to sign in and view available courses.
|
||||
|
||||
Releasing an Android app
|
||||
------------------------
|
||||
|
||||
**Note**: this is an untested feature.
|
||||
|
||||
Releasing an Android app on the Play Store requires to build the app in release mode. To do so, edit the ``$TUTOR_ROOT/config.yml`` configuration file and define the following variables::
|
||||
|
||||
ANDROID_RELEASE_STORE_PASSWORD
|
||||
ANDROID_RELEASE_KEY_PASSWORD
|
||||
ANDROID_RELEASE_KEY_ALIAS
|
||||
|
||||
Then, place your keystore file in ``$TUTOR_ROOT/env/android/app.keystore``. Finally, build the application with::
|
||||
|
||||
tutor android build release
|
||||
|
||||
Customising the Android app
|
||||
---------------------------
|
||||
|
||||
Customising the application, such as the logo or the background image, is currently not supported. If you are interested by this feature, please tell us about it in the Tutor `discussion forums <https://discuss.overhang.io>`_.
|
@ -40,16 +40,3 @@ Xqueue
|
||||
------
|
||||
|
||||
`Xqueue <https://github.com/edx/xqueue>`_ is for grading problems with external services. If you don't know what it is, you probably don't need it.
|
||||
|
||||
Android app (beta)
|
||||
------------------
|
||||
|
||||
The Android app for your platform can be easily built in just one command::
|
||||
|
||||
tutor android build debug
|
||||
|
||||
If all goes well, the debuggable APK for your platform should then be available in ./data/android. To obtain a release APK, you will need to obtain credentials from the app store and add them to ``config/android/gradle.properties``. Then run::
|
||||
|
||||
tutor android build release
|
||||
|
||||
Building the Android app for an Open edX platform is currently labeled as a **beta feature** because it was not fully tested yet. In particular, there is no easy mechanism for overriding the edX assets in the mobile app. This is still a work-in-progress.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import click
|
||||
|
||||
from . import config
|
||||
from . import config as tutor_config
|
||||
from . import env as tutor_env
|
||||
from . import fmt
|
||||
from . import opts
|
||||
@ -20,7 +20,12 @@ def android():
|
||||
)
|
||||
@opts.root
|
||||
def env(root):
|
||||
tutor_env.render_target(root, config.load(root), "android")
|
||||
config = tutor_config.load(root)
|
||||
# sub.domain.com -> com.domain.sub
|
||||
config["LMS_HOST_REVERSE"] = ".".join(config["LMS_HOST"].split(".")[::-1])
|
||||
tutor_env.render_target(root, config, "build")
|
||||
tutor_env.render_target(root, config, "android")
|
||||
click.echo(fmt.info("Environment generated in {}".format(root)))
|
||||
|
||||
@click.group(
|
||||
help="Build the application"
|
||||
@ -33,10 +38,7 @@ def build():
|
||||
)
|
||||
@opts.root
|
||||
def debug(root):
|
||||
docker_run(
|
||||
root, "./gradlew", "assembleProdDebuggable", "&&",
|
||||
"cp", "OpenEdXMobile/build/outputs/apk/prod/debuggable/*.apk", "/openedx/data/"
|
||||
)
|
||||
docker_run(root)
|
||||
click.echo(fmt.info("The debuggable APK file is available in {}".format(tutor_env.data_path(root, "android"))))
|
||||
|
||||
@click.command(
|
||||
@ -56,8 +58,8 @@ def pullimage():
|
||||
|
||||
def docker_run(root, *command):
|
||||
utils.docker_run(
|
||||
"--volume={}/:/openedx/config/".format(tutor_env.pathjoin(root, "android")),
|
||||
"--volume={}:/openedx/data".format(tutor_env.data_path(root, "android")),
|
||||
"--volume={}:/openedx/config/".format(tutor_env.pathjoin(root, "android")),
|
||||
"--volume={}:/openedx/data/".format(tutor_env.data_path(root, "android")),
|
||||
DOCKER_IMAGE,
|
||||
*command
|
||||
)
|
||||
|
@ -19,12 +19,16 @@ migrate_forum = "bundle exec rake search:initialize && bundle exec rake search:r
|
||||
migrate_notes = "./manage.py migrate"
|
||||
migrate_xqueue = "./manage.py migrate"
|
||||
|
||||
oauth2 = """{% if ACTIVATE_NOTES %}
|
||||
oauth2 = """
|
||||
./manage.py lms create_oauth2_client \
|
||||
"http://androidapp.com" "http://androidapp.com/redirect" public \
|
||||
--client_id android --client_secret {{ ANDROID_OAUTH2_SECRET }} \
|
||||
--trusted
|
||||
|
||||
{% if ACTIVATE_NOTES %}
|
||||
./manage.py lms manage_user notes notes@{{ LMS_HOST }} --staff --superuser
|
||||
./manage.py lms create_oauth2_client \
|
||||
"http://notes.openedx:8000" \
|
||||
"http://notes.openedx:8000/complete/edx-oidc/" \
|
||||
confidential \
|
||||
"http://notes.openedx:8000" "http://notes.openedx:8000/complete/edx-oidc/" confidential \
|
||||
--client_name edx-notes --client_id notes --client_secret {{ NOTES_OAUTH2_SECRET }} \
|
||||
--trusted --logout_uri "http://notes.openedx:8000/logout/" --username notes
|
||||
{% endif %}"""
|
||||
|
@ -1,5 +1,5 @@
|
||||
APPLICATION_ID=com.example.yourapp
|
||||
RELEASE_STORE_FILE=/openedx/config/your.keystore
|
||||
RELEASE_STORE_PASSWORD=your store password here
|
||||
RELEASE_KEY_PASSWORD=your key password here
|
||||
RELEASE_KEY_ALIAS=your key alias here
|
||||
APPLICATION_ID={{ LMS_HOST_REVERSE }}
|
||||
RELEASE_STORE_FILE=/openedx/config/app.keystore
|
||||
RELEASE_STORE_PASSWORD={{ ANDROID_STORE_PASSWORD }}
|
||||
RELEASE_KEY_PASSWORD={{ ANDROID_KEY_PASSWORD }}
|
||||
RELEASE_KEY_ALIAS={{ ANDROID_RELEASE_KEY_ALIAS }}
|
||||
|
@ -3,3 +3,4 @@ ENVIRONMENT_DISPLAY_NAME: 'tutor'
|
||||
PLATFORM_NAME: '{{ PLATFORM_NAME }}'
|
||||
PLATFORM_DESTINATION_NAME: '{{ LMS_HOST }}'
|
||||
FEEDBACK_EMAIL_ADDRESS: 'support@{{ LMS_HOST }}'
|
||||
OAUTH_CLIENT_ID: 'android'
|
||||
|
@ -7,10 +7,12 @@
|
||||
"PLATFORM_NAME": "{{ PLATFORM_NAME }}",
|
||||
"FEATURES": {
|
||||
"PREVIEW_LMS_BASE": "preview.{{ LMS_HOST }}",
|
||||
"ENABLE_OAUTH2_PROVIDER": true,
|
||||
"ENABLE_COURSE_DISCOVERY": true,
|
||||
"ENABLE_COURSEWARE_SEARCH": true,
|
||||
"ENABLE_DASHBOARD_SEARCH": true,
|
||||
"ENABLE_COMBINED_LOGIN_REGISTRATION": true,
|
||||
"ENABLE_MOBILE_REST_API": true,
|
||||
"ENABLE_OAUTH2_PROVIDER": true,
|
||||
"ENABLE_EDXNOTES": {{ "true" if ACTIVATE_NOTES else "false" }}
|
||||
},
|
||||
"LMS_ROOT_URL": "{{ "https" if ACTIVATE_HTTPS else "http" }}://{{ LMS_HOST }}",
|
||||
|
@ -23,7 +23,8 @@ RUN wget https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_
|
||||
RUN yes | /openedx/android-sdk/tools/bin/sdkmanager "platforms;android-27" 1> /dev/null
|
||||
|
||||
# Install android app repo
|
||||
RUN git clone https://github.com/edx/edx-app-android /openedx/edx-app-android
|
||||
# release/2.16.4 is the last know release to work with hawthorn
|
||||
RUN git clone https://github.com/edx/edx-app-android --branch release/2.16.4 --depth 1 /openedx/edx-app-android
|
||||
WORKDIR /openedx/edx-app-android
|
||||
|
||||
# Install gradle and all dependencies
|
||||
|
@ -10,3 +10,6 @@ XQUEUE_MYSQL_USERNAME: "xqueue"
|
||||
OPENEDX_DOCKER_IMAGE: "regis/openedx:hawthorn"
|
||||
NGINX_HTTP_PORT: 80
|
||||
NGINX_HTTPS_PORT: 443
|
||||
ANDROID_RELEASE_STORE_PASSWORD: "android store password"
|
||||
ANDROID_RELEASE_KEY_PASSWORD: "android release key password"
|
||||
ANDROID_RELEASE_KEY_ALIAS: "android release key alias"
|
||||
|
@ -12,8 +12,8 @@ NOTES_OAUTH2_SECRET: "{{ RAND24 }}"
|
||||
XQUEUE_AUTH_PASSWORD: "{{ RAND8 }}"
|
||||
XQUEUE_MYSQL_PASSWORD: "{{ RAND8 }}"
|
||||
XQUEUE_SECRET_KEY: "{{ RAND24 }}"
|
||||
ANDROID_OAUTH2_SECRET: "{{ RAND24 }}"
|
||||
ACTIVATE_HTTPS: false
|
||||
ACTIVATE_NOTES: false
|
||||
ACTIVATE_XQUEUE: false
|
||||
ID: "{{ RAND8 }}"
|
||||
# pouac plonk
|
||||
|
Loading…
Reference in New Issue
Block a user