Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be36969dce | ||
|
|
25fa14e030 | ||
|
|
8b682f0902 | ||
|
|
a539ca2693 | ||
|
|
cfee151f6b | ||
|
|
78b29f1ec6 | ||
|
|
7b4af1f15c | ||
|
|
c2ba1b57fd | ||
|
|
243bbeb79a | ||
|
|
05fc54b68d | ||
|
|
8fa95c708f | ||
|
|
46ed8a91cd | ||
|
|
8d04f8ac02 | ||
|
|
ca03a2f844 | ||
|
|
1d87ec5193 | ||
|
|
5d2e945a15 | ||
|
|
bef534a00d | ||
|
|
aa1c67a6a3 | ||
|
|
b7af7ba707 | ||
|
|
d43952befb | ||
|
|
cb789e8604 | ||
|
|
af56259343 | ||
|
|
519062a168 | ||
|
|
097ad05609 | ||
|
|
5648bc4829 | ||
|
|
3f19e83300 | ||
|
|
96404d74c0 | ||
|
|
446587b788 | ||
|
|
b8281e51dc | ||
|
|
2dd92f1801 | ||
|
|
dde6ed73dc | ||
|
|
95d7c74377 | ||
|
|
145ac9519a | ||
|
|
4d4bc48689 | ||
|
|
e35b24fd53 | ||
|
|
13e384484b | ||
|
|
5f10cfe451 | ||
|
|
b5d60b812c | ||
|
|
f5f11b8ef6 | ||
|
|
24ed22f36f | ||
|
|
ffe3d6bcf9 | ||
|
|
93c9168ff5 | ||
|
|
3e697590c3 | ||
|
|
93edbdeea5 | ||
|
|
7726bfb1c6 | ||
|
|
7776ba9ce2 | ||
|
|
f421b6804c | ||
|
|
fa644d342d | ||
|
|
35e375cd26 | ||
|
|
cdd3f5e499 | ||
|
|
df108fd4c6 | ||
|
|
139f241de4 | ||
|
|
f59425268a | ||
|
|
0cb623b1c0 | ||
|
|
98ba2a58e7 | ||
|
|
5a005908cb | ||
|
|
7dea2459a7 | ||
|
|
c775b8348b | ||
|
|
084318a5ef | ||
|
|
a433d48a7d | ||
|
|
06feeb087e | ||
|
|
15e496e0b1 | ||
|
|
f2fb5680eb | ||
|
|
b83745a77c | ||
|
|
9ce82f787e | ||
|
|
1ee7014960 | ||
|
|
fd44a2d9eb | ||
|
|
56de7a8f5b | ||
|
|
3b2b0546ec | ||
|
|
d7cbce8467 | ||
|
|
32ce115a27 | ||
|
|
a1a9aeb7a3 | ||
|
|
a92475e07b | ||
|
|
772939d992 | ||
|
|
1f9450c177 | ||
|
|
71d8643480 | ||
|
|
3f9987eeff | ||
|
|
c1ddb65cb5 | ||
|
|
dac6dd5418 | ||
|
|
f3d48d742a | ||
|
|
fdf79fa0e4 | ||
|
|
8572483d95 | ||
|
|
999fe79a29 |
20
.github/workflows/auto-add-to-project.yml
vendored
Normal file
20
.github/workflows/auto-add-to-project.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Auto Add Issues and Pull Requests to Project
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
# https://github.com/actions/add-to-project
|
||||
add-to-project:
|
||||
name: Add issue and bugs to project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/add-to-project@v1.0.2
|
||||
with:
|
||||
project-url: https://github.com/orgs/overhangio/projects/4
|
||||
github-token: ${{ secrets.GH_PROJECT_PERSONAL_ACCESS_TOKEN }}
|
||||
4
.github/workflows/sync.yml
vendored
4
.github/workflows/sync.yml
vendored
@ -2,13 +2,13 @@ name: Sync with private repo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, main, nightly ]
|
||||
branches: [ release, main ]
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Add remote
|
||||
|
||||
25
.github/workflows/test.yml
vendored
Normal file
25
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
name: Run tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ release, main ]
|
||||
push:
|
||||
branches: [ release, main ]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.9', '3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install .[dev]
|
||||
- name: Test lint, types, and format
|
||||
run: make test
|
||||
@ -2,9 +2,7 @@ variables:
|
||||
TUTOR_PLUGIN: android
|
||||
TUTOR_IMAGES: android
|
||||
TUTOR_PYPI_PACKAGE: tutor-android
|
||||
OPENEDX_RELEASE: olive
|
||||
GITHUB_REPO: overhangio/tutor-android
|
||||
IMAGES_BUILD_PLATFORM: "linux/amd64"
|
||||
|
||||
include:
|
||||
- project: 'community/tutor-ci'
|
||||
|
||||
22
.hatch_build.py
Normal file
22
.hatch_build.py
Normal file
@ -0,0 +1,22 @@
|
||||
# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
|
||||
import os
|
||||
import typing as t
|
||||
|
||||
from hatchling.metadata.plugin.interface import MetadataHookInterface
|
||||
|
||||
HERE = os.path.dirname(__file__)
|
||||
|
||||
|
||||
class MetaDataHook(MetadataHookInterface):
|
||||
def update(self, metadata: dict[str, t.Any]) -> None:
|
||||
about = load_about()
|
||||
metadata["version"] = about["__version__"]
|
||||
|
||||
|
||||
def load_about() -> dict[str, str]:
|
||||
about: dict[str, str] = {}
|
||||
with open(
|
||||
os.path.join(HERE, "tutorandroid", "__about__.py"), "rt", encoding="utf-8"
|
||||
) as f:
|
||||
exec(f.read(), about)
|
||||
return about
|
||||
42
CHANGELOG.md
42
CHANGELOG.md
@ -19,6 +19,48 @@ instructions, because git commits are used to generate release notes:
|
||||
|
||||
<!-- scriv-insert-here -->
|
||||
|
||||
<a id='changelog-20.0.0'></a>
|
||||
## v20.0.0 (2025-06-10)
|
||||
|
||||
- [Improvement] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @Abdul-Muqadim-Arbisoft)
|
||||
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
|
||||
|
||||
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
|
||||
|
||||
- 💥[Feature] Upgrade to teak. (by @Abdul-Muqadim-Arbisoft)
|
||||
|
||||
<a id='changelog-19.0.0'></a>
|
||||
## v19.0.0 (2024-12-09)
|
||||
|
||||
- 💥[Feature] Upgrade to Sumac (by @Abdul-Muqadim-Arbisoft)
|
||||
|
||||
<a id='changelog-18.0.1'></a>
|
||||
## v18.0.1 (2024-11-28)
|
||||
|
||||
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)
|
||||
- 💥[Feature] Update android image to use Ubuntu `24.04` as base OS. (by @Abdul-Muqadim-Arbisoft)
|
||||
- 💥 [Deprecation] Drop support for python 3.8 and set Python 3.9 as the minimum supported python version. (by @Abdul-Muqadim-Arbisoft)
|
||||
- 💥[Improvement] Rename Tutor's two branches (by @DawoudSheraz):
|
||||
* Rename **master** to **release**, as this branch runs the latest official Open edX release tag.
|
||||
* Rename **nightly** to **main**, as this branch runs the Open edX master branches, which are the basis for the next Open edX release.
|
||||
|
||||
<a id='changelog-18.0.0'></a>
|
||||
## v18.0.0 (2024-06-20)
|
||||
|
||||
- 💥[Feature] Upgrade to redwood (by @dawoudsheraz)
|
||||
- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb)
|
||||
- 💥[Feature] Upgrade the deprecated [edx-app-android](https://github.com/openedx-unsupported/edx-app-android) to [openedx-app-android](https://github.com/openedx/openedx-app-android). (by @hamza-56)
|
||||
- [Feature] Update the tutor.yaml configuration to align with the new app’s default settings. See the default configuration here: [default_config/prod/config.yaml](https://github.com/openedx/openedx-app-android/blob/main/default_config/prod/config.yaml) (by @cmltawt0).
|
||||
- [Feature] Enhanced `ANDROID_APP_VERSION` logic to dynamically set the version based on `OPENEDX_COMMON_VERSION`: for nightly builds, `ANDROID_APP_VERSION` is set to main. For other builds, `ANDROID_APP_VERSION` is set to the value of `OPENEDX_COMMON_VERSION`. (by @hamza-56)
|
||||
|
||||
|
||||
<a id='changelog-17.0.0'></a>
|
||||
## v17.0.0 (2023-12-09)
|
||||
|
||||
- 💥 [Feature] Upgrade to Quince (by @muhammadali286).
|
||||
- The nightly branch will now build the master branch of the edx-app-android repository. (by @regisb)
|
||||
- [Improvement] Added Typing to code, Makefile and test action to the repository and formatted code with Black and isort. (by @CodeWithEmad)
|
||||
|
||||
<a id='changelog-16.0.0'></a>
|
||||
## v16.0.0 (2023-06-14)
|
||||
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
recursive-include tutorandroid/patches *
|
||||
recursive-include tutorandroid/templates *
|
||||
42
Makefile
Normal file
42
Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: docs
|
||||
SRC_DIRS = ./tutorandroid
|
||||
|
||||
# Warning: These checks are not necessarily run on every PR.
|
||||
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
|
||||
|
||||
test-format: ## Run code formatting tests
|
||||
ruff format --check --diff ${SRC_DIRS}
|
||||
|
||||
test-lint: ## Run code linting tests
|
||||
ruff check ${SRC_DIRS}
|
||||
|
||||
test-types: ## Run type checks.
|
||||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
||||
|
||||
build-pythonpackage: ## Build the "tutor-android" python package for upload to pypi
|
||||
python -m build --sdist
|
||||
|
||||
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
|
||||
twine check dist/tutor_android-$(shell make version).tar.gz
|
||||
|
||||
format: ## Format code automatically
|
||||
ruff format ${SRC_DIRS}
|
||||
|
||||
fix-lint: ## Fix lint errors automatically
|
||||
ruff check --fix ${SRC_DIRS}
|
||||
|
||||
changelog-entry: ## Create a new changelog entry.
|
||||
scriv create
|
||||
|
||||
changelog: ## Collect changelog entries in the CHANGELOG.md file.
|
||||
scriv collect
|
||||
|
||||
version: ## Print the current tutor-android version
|
||||
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorandroid", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
|
||||
|
||||
ESCAPE =
|
||||
help: ## Print this help
|
||||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
|
||||
| sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \
|
||||
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
23
README.rst
23
README.rst
@ -1,4 +1,4 @@
|
||||
Android application plugin for `Tutor <https://docs.tutor.overhang.io>`__
|
||||
Android application plugin for `Tutor <https://docs.tutor.edly.io>`__
|
||||
=========================================================================
|
||||
|
||||
This is a plugin to easily build an Android mobile application for your `Open edX <https://open.edx.org>`__ instance.
|
||||
@ -18,24 +18,29 @@ Enable the plugin and start the platform::
|
||||
tutor plugins enable android
|
||||
tutor local launch
|
||||
|
||||
|
||||
The ``.apk`` file will then be available for download at http(s)://mobile.LMS_HOST/app.apk. When running locally, this will be: http://mobile.local.overhang.io/app.apk. You can forward this address to your students for download.
|
||||
The ``.apk`` file will then be available for download at http(s)://mobile.LMS_HOST/app.apk. When running locally, this will be: http://mobile.local.openedx.io/app.apk. You can forward this address to your students for download.
|
||||
|
||||
Building a custom Android app
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The Android app is built from the `official edx-app-android repository <https://github.com/edx/edx-app-android/>`__. To change this repository or the app version, you can simply build a different docker image with::
|
||||
The Android app is built from the `official openedx-app-android repository <https://github.com/openedx/openedx-app-android/>`__. To change this repository or the app version, you can simply build a different docker image with::
|
||||
|
||||
tutor images build \
|
||||
--build-arg ANDROID_APP_REPOSITORY=https://github.com/mycustomfork/edx-app-android \
|
||||
--build-arg ANDROID_APP_REPOSITORY=https://github.com/mycustomfork/openedx-app-android \
|
||||
--build-arg ANDROID_APP_VERSION=master \
|
||||
android
|
||||
|
||||
Alternatively, you can build an image from a local checked-out fork of edx-app-android::
|
||||
Alternatively, you can build an image from a local checked-out fork of openedx-app-android::
|
||||
|
||||
tutor mounts add /path/to/edx-app-android
|
||||
tutor mounts add /path/to/openedx-app-android
|
||||
tutor local launch
|
||||
|
||||
Making courses visible in app
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By default, courses are not visible in the mobile app. To make them available, go to Studio → YOUR COURSE → Settings → Advanced Settings and set ``Mobile Course Available`` to true.
|
||||
|
||||
|
||||
Releasing an Android app
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -61,9 +66,9 @@ Customising the application, such as the logo or the background image, is curren
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
This Tutor plugin is maintained by Régis Behmo from `Overhang.IO <https://overhang.io>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.overhang.io/troubleshooting.html>`__ section from the Tutor documentation.
|
||||
This Tutor plugin is maintained by Abdul-Muqadim from `Edly <https://edly.io>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ section from the Tutor documentation.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This software is licensed under the terms of the AGPLv3.
|
||||
This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-android/blob/release/LICENSE.txt>`_.
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
- [Improvement] Migrate from pylint and black to ruff. (by @Abdul-Muqadim-Arbisoft)
|
||||
- [Improvement] Test python package distribution build when running make test. (by @Abdul-Muqadim-Arbisoft)
|
||||
@ -1,2 +1,83 @@
|
||||
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
||||
# https://hatch.pypa.io/latest/config/build/
|
||||
|
||||
[project]
|
||||
name = "tutor-android"
|
||||
license = { text = "AGPL-3.0-only" }
|
||||
authors = [
|
||||
{ name = "Edly" },
|
||||
{ email = "hello@edly.io" }
|
||||
]
|
||||
maintainers = [
|
||||
{ name = "Abdul-Muqadim" },
|
||||
{ email = "abdul.muqadim@arbisoft.com" }
|
||||
]
|
||||
description = "Android mobile app plugin for Tutor"
|
||||
readme = { file = "README.rst", content-type = "text/x-rst" }
|
||||
requires-python = ">=3.9"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"tutor>=20.0.0,<21.0.0"
|
||||
]
|
||||
# Version will be dynamically loaded from __about__.py
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"tutor[dev]>=20.0.0,<21.0.0",
|
||||
"ruff",
|
||||
]
|
||||
|
||||
[project.entry-points."tutor.plugin.v1"]
|
||||
android = "tutorandroid.plugin"
|
||||
|
||||
# URLs for documentation and issue tracking
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/overhangio/tutor-android"
|
||||
Documentation = "https://github.com/overhangio/tutor-android"
|
||||
Code = "https://github.com/overhangio/tutor-android"
|
||||
Issues = "https://github.com/overhangio/tutor-android/issues"
|
||||
Community = "https://discuss.openedx.org/tag/tutor"
|
||||
|
||||
# Hatch-specific configuration
|
||||
[tool.hatch.metadata.hooks.custom]
|
||||
path = ".hatch_build.py"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools", "wheel"]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
# Disable strict naming for twine compatibility
|
||||
strict-naming = false
|
||||
include = [ "/tutorandroid", '.hatch_build.py' ]
|
||||
exclude = [ "tests*" ]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["tutorandroid"]
|
||||
|
||||
[tool.ruff]
|
||||
exclude = ["templates", "docs/_ext"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
# E: pycodestyle errors
|
||||
# I: isort
|
||||
# N: pep8-naming
|
||||
select = ["E", "I", "N"]
|
||||
|
||||
# F401: unused-import
|
||||
# F841: unused-variable
|
||||
# W292: missing-newline-at-end-of-file
|
||||
extend-select = ["F401", "F841", "W292"]
|
||||
|
||||
[tool.ruff.format]
|
||||
|
||||
63
setup.py
63
setup.py
@ -1,63 +0,0 @@
|
||||
import io
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def load_readme():
|
||||
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def load_about():
|
||||
about = {}
|
||||
with io.open(
|
||||
os.path.join(HERE, "tutorandroid", "__about__.py"),
|
||||
"rt",
|
||||
encoding="utf-8",
|
||||
) as f:
|
||||
exec(f.read(), about) # pylint: disable=exec-used
|
||||
return about
|
||||
|
||||
|
||||
ABOUT = load_about()
|
||||
|
||||
|
||||
setup(
|
||||
name="tutor-android",
|
||||
version=ABOUT["__version__"],
|
||||
url="https://github.com/overhangio/tutor-android",
|
||||
project_urls={
|
||||
"Code": "https://github.com/overhangio/tutor-android",
|
||||
"Issue tracker": "https://github.com/overhangio/tutor-android/issues",
|
||||
"Community": "https://discuss.openedx.org",
|
||||
},
|
||||
license="AGPLv3",
|
||||
author="Overhang.IO",
|
||||
author_email="contact@overhang.io",
|
||||
maintainer="Overhang.IO",
|
||||
maintainer_email="regis@overhang.io",
|
||||
description="Android mobile app plugin for Tutor",
|
||||
long_description=load_readme(),
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
include_package_data=True,
|
||||
python_requires=">=3.8",
|
||||
install_requires=["tutor>=16.0.0,<17.0.0"],
|
||||
entry_points={
|
||||
"tutor.plugin.v1": [
|
||||
"android = tutorandroid.plugin"
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
],
|
||||
)
|
||||
@ -1,8 +1 @@
|
||||
__version__ = "16.0.0"
|
||||
|
||||
# Handle version suffix for nightly, just like tutor core.
|
||||
__version_suffix__ = ""
|
||||
|
||||
if __version_suffix__:
|
||||
__version__ += "-" + __version_suffix__
|
||||
|
||||
__version__ = "20.0.0"
|
||||
|
||||
@ -15,12 +15,11 @@ spec:
|
||||
app.kubernetes.io/name: android-app
|
||||
spec:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
runAsUser: {{ APP_USER_ID }}
|
||||
runAsGroup: {{ APP_USER_ID }}
|
||||
containers:
|
||||
- name: android-app
|
||||
image: {{ ANDROID_APP_DOCKER_IMAGE }}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
securityContext:
|
||||
|
||||
@ -1,35 +1,43 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from glob import glob
|
||||
import os
|
||||
import typing as t
|
||||
from glob import glob
|
||||
|
||||
import pkg_resources
|
||||
|
||||
import importlib_resources
|
||||
from tutor import hooks as tutor_hooks
|
||||
from tutor.__about__ import __version_suffix__
|
||||
from tutor.types import Config, get_typed
|
||||
|
||||
from .__about__ import __version__
|
||||
|
||||
config = {
|
||||
"unique": {"OAUTH2_SECRET": "{{ 24|random_string }}"},
|
||||
# Handle version suffix in main mode, just like tutor core
|
||||
if __version_suffix__:
|
||||
__version__ += "-" + __version_suffix__
|
||||
|
||||
|
||||
config: t.Dict[str, t.Dict[str, t.Any]] = {
|
||||
"defaults": {
|
||||
"VERSION": __version__,
|
||||
"APP_HOST": "mobile.{{ LMS_HOST }}",
|
||||
# Version 4.0.0 is not working:
|
||||
# https://github.com/overhangio/tutor-android/pull/6#issuecomment-1541510489
|
||||
"APP_VERSION": "3.1.4",
|
||||
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android:{{ ANDROID_VERSION }}",
|
||||
"APP_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android-app:{{ ANDROID_VERSION }}",
|
||||
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android:{{ ANDROID_VERSION }}", # noqa: E501
|
||||
"APP_DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-android-app:{{ ANDROID_VERSION }}", # noqa: E501
|
||||
"ENABLE_RELEASE_MODE": False,
|
||||
"RELEASE_STORE_PASSWORD": "android store password",
|
||||
"RELEASE_KEY_PASSWORD": "android release key password",
|
||||
"RELEASE_KEY_ALIAS": "android release key alias",
|
||||
},
|
||||
"unique": {
|
||||
"OAUTH2_SECRET": "{{ 24|random_string }}",
|
||||
},
|
||||
}
|
||||
|
||||
with open(
|
||||
os.path.join(
|
||||
pkg_resources.resource_filename("tutorandroid", "templates"),
|
||||
str(importlib_resources.files("tutorandroid") / "templates"),
|
||||
"android",
|
||||
"tasks",
|
||||
"lms",
|
||||
@ -63,7 +71,9 @@ tutor_hooks.Filters.IMAGES_BUILD.add_items(
|
||||
|
||||
@tutor_hooks.Filters.IMAGES_PULL.add()
|
||||
@tutor_hooks.Filters.IMAGES_PUSH.add()
|
||||
def _add_remote_android_app_image_iff_customized(images, user_config):
|
||||
def _add_remote_android_app_image_iff_customized(
|
||||
images: list[tuple[str, str]], user_config: Config
|
||||
) -> list[tuple[str, str]]:
|
||||
"""
|
||||
Register ANDROID-APP image for pushing & pulling if and only if it has
|
||||
been set to something other than the default.
|
||||
@ -75,7 +85,7 @@ def _add_remote_android_app_image_iff_customized(images, user_config):
|
||||
to push/pull the ANDROID-APP image if the user has customized it to anything
|
||||
other than the default image URL.
|
||||
"""
|
||||
image_tag = user_config["ANDROID_APP_DOCKER_IMAGE"]
|
||||
image_tag = get_typed(user_config, "ANDROID_APP_DOCKER_IMAGE", str, "")
|
||||
if not image_tag.startswith("docker.io/overhangio/openedx-android-app:"):
|
||||
# Image has been customized. Add to list for pulling/pushing.
|
||||
images.append(("android-app", image_tag))
|
||||
@ -106,9 +116,9 @@ def _build_custom_android_app(
|
||||
mounts: list[tuple[str, str]], host_path: str
|
||||
) -> list[tuple[str, str]]:
|
||||
path_basename = os.path.basename(host_path)
|
||||
if path_basename == "edx-app-android":
|
||||
if path_basename == "openedx-app-android":
|
||||
# Bind-mount repo at build-time
|
||||
mounts.append(("android", "edx-app-android"))
|
||||
mounts.append(("android", "openedx-app-android"))
|
||||
return mounts
|
||||
|
||||
|
||||
@ -123,10 +133,9 @@ def _print_android_app_public_hosts(
|
||||
return hostnames
|
||||
|
||||
|
||||
####### Boilerplate code
|
||||
# Add the "templates" folder as a template root
|
||||
tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
|
||||
pkg_resources.resource_filename("tutorandroid", "templates")
|
||||
str(importlib_resources.files("tutorandroid") / "templates")
|
||||
)
|
||||
# Render the "build" and "apps" folders
|
||||
tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
|
||||
@ -138,7 +147,7 @@ tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
|
||||
# Load patches from files
|
||||
for path in glob(
|
||||
os.path.join(
|
||||
pkg_resources.resource_filename("tutorandroid", "patches"),
|
||||
str(importlib_resources.files("tutorandroid") / "patches"),
|
||||
"*",
|
||||
)
|
||||
):
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
FROM docker.io/ubuntu:22.04 AS base
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM docker.io/ubuntu:24.04 AS base
|
||||
LABEL maintainer="Overhang.IO <contact@overhang.io>"
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked {% endif %}apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y wget unzip git openjdk-11-jre openjdk-11-jdk
|
||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y wget unzip git openjdk-17-jre openjdk-17-jdk
|
||||
|
||||
RUN mkdir /app
|
||||
|
||||
@ -15,9 +16,9 @@ FROM base AS sdk
|
||||
# Install Android SDK
|
||||
# Inspired from https://github.com/LiveXP/docker-android-sdk/blob/master/Dockerfile
|
||||
# Get sdk version from here: https://developer.android.com/studio#command-tools
|
||||
ENV ANDROID_SDK_VERSION 9477386
|
||||
ENV ANDROID_SDK_PATH /app/android-sdk
|
||||
ENV ANDROID_HOME /app/android-sdk
|
||||
ENV ANDROID_SDK_VERSION=11076708
|
||||
ENV ANDROID_SDK_PATH=/app/android-sdk
|
||||
ENV ANDROID_HOME=/app/android-sdk
|
||||
RUN mkdir ${ANDROID_HOME}
|
||||
WORKDIR /app/android-sdk
|
||||
RUN wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip && \
|
||||
@ -27,47 +28,50 @@ RUN wget --quiet https://dl.google.com/android/repository/commandlinetools-linux
|
||||
# Accept licenses
|
||||
# https://developer.android.com/studio/command-line/sdkmanager
|
||||
# Check target version: https://github.com/edx/edx-app-android/blob/master/constants.gradle
|
||||
ARG ANDROID_API_LEVEL=31
|
||||
ARG ANDROID_API_LEVEL=34
|
||||
RUN yes | /app/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --install "platforms;android-$ANDROID_API_LEVEL" 1> /dev/null
|
||||
|
||||
###### Checkout code
|
||||
FROM base AS code
|
||||
# Install android app repo
|
||||
ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/edx-app-android
|
||||
ARG ANDROID_APP_VERSION=release/{{ ANDROID_APP_VERSION }}
|
||||
RUN git clone $ANDROID_APP_REPOSITORY --branch $ANDROID_APP_VERSION /app/edx-app-android
|
||||
ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/openedx-app-android.git
|
||||
ARG ANDROID_APP_VERSION={% if OPENEDX_COMMON_VERSION == "master" %}main{% else %}{{ OPENEDX_COMMON_VERSION }}{% endif %}
|
||||
ADD --keep-git-dir $ANDROID_APP_REPOSITORY#$ANDROID_APP_VERSION /app/openedx-app-android
|
||||
|
||||
###### Empty layer to mount custom repo at build time
|
||||
FROM scratch AS edx-app-android
|
||||
COPY --from=code /app/edx-app-android /
|
||||
FROM scratch AS openedx-app-android
|
||||
COPY --from=code /app/openedx-app-android /
|
||||
|
||||
###### Common layer, which will be used to build the user-specific image later
|
||||
FROM sdk AS common
|
||||
|
||||
COPY --from=edx-app-android / /app/edx-app-android
|
||||
WORKDIR /app/edx-app-android
|
||||
COPY --from=openedx-app-android / /app/openedx-app-android
|
||||
WORKDIR /app/openedx-app-android
|
||||
|
||||
# Install gradle and all dependencies
|
||||
RUN ./gradlew -v
|
||||
RUN ./gradlew tasks
|
||||
|
||||
###### Build image with app-specific settings
|
||||
FROM common as build
|
||||
FROM common AS build
|
||||
|
||||
# User-customized config
|
||||
COPY ./config/edx.properties ./OpenEdXMobile/default_config/edx.properties
|
||||
COPY ./config/tutor.yaml ./OpenEdXMobile/default_config/tutor.yaml
|
||||
COPY ./config/tutor.yaml ./default_config/dev/config.yaml
|
||||
COPY ./config/tutor.yaml ./default_config/stage/config.yaml
|
||||
COPY ./config/tutor.yaml ./default_config/prod/config.yaml
|
||||
{% if ANDROID_ENABLE_RELEASE_MODE %}
|
||||
# Add release settings
|
||||
COPY ./config/gradle.properties ./gradle.properties.tutor
|
||||
RUN cat ./gradle.properties.tutor >> ./gradle.properties
|
||||
{% endif %}
|
||||
|
||||
RUN sed -i "s/APPLICATION_ID = .*/APPLICATION_ID = \"{{ LMS_HOST|reverse_host|replace("-", "_") }}\"/g" constants.gradle
|
||||
RUN ./gradlew assembleProd{{ "Release" if ANDROID_ENABLE_RELEASE_MODE else "Debuggable" }}
|
||||
# uncomment this line for for release APK.
|
||||
# RUN sed -i "s/APPLICATION_ID = .*/APPLICATION_ID = \"{{ LMS_HOST|reverse_host|replace("-", "_") }}\"/g" constants.gradle
|
||||
RUN ./gradlew assembleProd{{ "Release" if ANDROID_ENABLE_RELEASE_MODE else "Debug" }}
|
||||
# ./gradlew assembleProdRelease
|
||||
|
||||
#### File server to serve apk file
|
||||
# https://hub.docker.com/_/caddy?tab=tags
|
||||
FROM docker.io/caddy:2.6.4-alpine as production
|
||||
COPY --from=build /app/edx-app-android/OpenEdXMobile/build/outputs/apk/prod/{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debuggable" }}/edx-{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debuggable" }}-{{ ANDROID_APP_VERSION }}.apk /srv/app.apk
|
||||
FROM docker.io/caddy:2.6.4-alpine AS production
|
||||
COPY --from=build /app/openedx-app-android/app/build/outputs/apk/prod/{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debug" }}/app-prod-{{ "release" if ANDROID_ENABLE_RELEASE_MODE else "debug" }}.apk /srv/app.apk
|
||||
CMD caddy file-server --listen=:8000 --root=/srv
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
RELEASE_STORE_FILE=/app/edx-app-android/OpenEdXMobile/app.keystore
|
||||
RELEASE_STORE_FILE=/app/openedx-app-android/app.keystore
|
||||
RELEASE_STORE_PASSWORD={{ ANDROID_RELEASE_STORE_PASSWORD }}
|
||||
RELEASE_KEY_PASSWORD={{ ANDROID_RELEASE_KEY_PASSWORD }}
|
||||
RELEASE_KEY_ALIAS={{ ANDROID_RELEASE_KEY_ALIAS }}
|
||||
|
||||
@ -1,18 +1,83 @@
|
||||
# See docs: https://openedx.atlassian.net/wiki/spaces/LEARNER/pages/48792067/App+Configuration+Flags
|
||||
API_HOST_URL: "{{ "https" if ENABLE_HTTPS else "http" }}://{{ LMS_HOST }}"
|
||||
APPLICATION_ID: 'org.openedx.app'
|
||||
ENVIRONMENT_DISPLAY_NAME: "tutor"
|
||||
PLATFORM_NAME: "{{ PLATFORM_NAME }}"
|
||||
PLATFORM_DESTINATION_NAME: "{{ LMS_HOST }}"
|
||||
URI_SCHEME: ''
|
||||
FEEDBACK_EMAIL_ADDRESS: "{{ CONTACT_EMAIL }}"
|
||||
FAQ_URL: ''
|
||||
OAUTH_CLIENT_ID: "android"
|
||||
|
||||
COURSE_VIDEOS_ENABLED: true
|
||||
CERTIFICATES_ENABLED: true
|
||||
DISCUSSIONS_ENABLED: true
|
||||
# Keep empty to hide setting
|
||||
AGREEMENT_URLS:
|
||||
PRIVACY_POLICY_URL: ''
|
||||
COOKIE_POLICY_URL: ''
|
||||
DATA_SELL_CONSENT_URL: ''
|
||||
TOS_URL: ''
|
||||
EULA_URL: ''
|
||||
SUPPORTED_LANGUAGES: [ ] #en is default language
|
||||
|
||||
DISCOVERY:
|
||||
COURSE:
|
||||
TYPE: native
|
||||
DOWNLOAD_TO_SD_CARD_ENABLED: true
|
||||
NEW_LOGISTRATION_ENABLED: true
|
||||
USER_PROFILES_ENABLED : true
|
||||
VIDEO_TRANSCRIPT_ENABLED: true
|
||||
TYPE: 'native'
|
||||
WEBVIEW:
|
||||
BASE_URL: ''
|
||||
COURSE_DETAIL_TEMPLATE: ''
|
||||
PROGRAM_DETAIL_TEMPLATE: ''
|
||||
|
||||
PROGRAM:
|
||||
TYPE: 'native'
|
||||
WEBVIEW:
|
||||
PROGRAM_URL: ''
|
||||
PROGRAM_DETAIL_URL_TEMPLATE: ''
|
||||
|
||||
FIREBASE:
|
||||
ENABLED: false
|
||||
ANALYTICS_SOURCE: '' # segment | none
|
||||
CLOUD_MESSAGING_ENABLED: false
|
||||
PROJECT_NUMBER: ''
|
||||
PROJECT_ID: ''
|
||||
APPLICATION_ID: '' #App ID field from the Firebase console or mobilesdk_app_id from the google-services.json file.
|
||||
API_KEY: ''
|
||||
|
||||
SEGMENT_IO:
|
||||
ENABLED: false
|
||||
SEGMENT_IO_WRITE_KEY: ''
|
||||
|
||||
BRAZE:
|
||||
ENABLED: false
|
||||
PUSH_NOTIFICATIONS_ENABLED: false
|
||||
|
||||
GOOGLE:
|
||||
ENABLED: false
|
||||
CLIENT_ID: ''
|
||||
|
||||
MICROSOFT:
|
||||
ENABLED: false
|
||||
CLIENT_ID: ''
|
||||
PACKAGE_SIGNATURE: ''
|
||||
|
||||
FACEBOOK:
|
||||
ENABLED: false
|
||||
FACEBOOK_APP_ID: ''
|
||||
CLIENT_TOKEN: ''
|
||||
|
||||
BRANCH:
|
||||
ENABLED: false
|
||||
KEY: ''
|
||||
URI_SCHEME: ''
|
||||
HOST: ''
|
||||
ALTERNATE_HOST: ''
|
||||
|
||||
#Platform names
|
||||
PLATFORM_NAME: "{{ PLATFORM_NAME }}"
|
||||
PLATFORM_FULL_NAME: "{{ PLATFORM_NAME }}"
|
||||
#App sourceSets dir
|
||||
THEME_DIRECTORY: "openedx"
|
||||
#tokenType enum accepts JWT and BEARER only
|
||||
TOKEN_TYPE: "JWT"
|
||||
#feature flag for activating What’s New feature
|
||||
WHATS_NEW_ENABLED: false
|
||||
#feature flag enable Social Login buttons
|
||||
SOCIAL_AUTH_ENABLED: false
|
||||
#Course navigation feature flags
|
||||
COURSE_NESTED_LIST_ENABLED: false
|
||||
COURSE_UNIT_PROGRESS_ENABLED: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user