From b5d60b812c11624d9e766e1eb59dc2bc04b51ee3 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft <139064778+Abdul-Muqadim-Arbisoft@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:59:22 +0500 Subject: [PATCH 1/4] Update plugin for compatibility with new openedx mobile repositories and upgrade dependencies (#21) --- README.rst | 8 ++--- ...ashafique_update_dependencies_new_repos.md | 1 + tutorandroid/plugin.py | 4 +-- .../templates/android/build/Dockerfile | 31 ++++++++++--------- .../android/build/config/gradle.properties | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md diff --git a/README.rst b/README.rst index 1e5825e..b334a54 100644 --- a/README.rst +++ b/README.rst @@ -23,16 +23,16 @@ The ``.apk`` file will then be available for download at http(s)://mobile.LMS_HO Building a custom Android app ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The Android app is built from the `official edx-app-android repository `__. 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 `__. 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 diff --git a/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md b/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md new file mode 100644 index 0000000..781dc8a --- /dev/null +++ b/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md @@ -0,0 +1 @@ +- [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) diff --git a/tutorandroid/plugin.py b/tutorandroid/plugin.py index 41a69ff..255e079 100644 --- a/tutorandroid/plugin.py +++ b/tutorandroid/plugin.py @@ -116,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 diff --git a/tutorandroid/templates/android/build/Dockerfile b/tutorandroid/templates/android/build/Dockerfile index 0352dc4..f74a3dd 100644 --- a/tutorandroid/templates/android/build/Dockerfile +++ b/tutorandroid/templates/android/build/Dockerfile @@ -16,7 +16,7 @@ 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 10406996 +ENV ANDROID_SDK_VERSION 11076708 ENV ANDROID_SDK_PATH /app/android-sdk ENV ANDROID_HOME /app/android-sdk RUN mkdir ${ANDROID_HOME} @@ -28,27 +28,26 @@ 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=33 +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.git - -# Please add ANDROID_APP_VERSION value in tutor config from release version https://github.com/openedx/edx-app-android/tags -ARG ANDROID_APP_VERSION={% if OPENEDX_COMMON_VERSION == "master" %}master{% else %}release/{{ ANDROID_APP_VERSION }}{% endif %} -ADD --keep-git-dir $ANDROID_APP_REPOSITORY#$ANDROID_APP_VERSION /app/edx-app-android +ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/openedx-app-android.git +# Always use the 'main' branch +ARG ANDROID_APP_VERSION=main +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 @@ -58,8 +57,9 @@ RUN ./gradlew tasks 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 @@ -68,10 +68,11 @@ RUN cat ./gradle.properties.tutor >> ./gradle.properties # 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 "Debuggable" }} +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 +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 diff --git a/tutorandroid/templates/android/build/config/gradle.properties b/tutorandroid/templates/android/build/config/gradle.properties index f915656..9ebedea 100644 --- a/tutorandroid/templates/android/build/config/gradle.properties +++ b/tutorandroid/templates/android/build/config/gradle.properties @@ -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 }} From 5f10cfe451a2f6d9ef7eff5c264ab1aa0a9e7e30 Mon Sep 17 00:00:00 2001 From: Hamza Shafique <41573849+hamza-56@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:14:33 +0500 Subject: [PATCH 2/4] feat: build main branch in nightly --- ...610_212617_hamzashafiquehere_dynamic_android_app_version.md | 1 + tutorandroid/templates/android/build/Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md diff --git a/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md b/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md new file mode 100644 index 0000000..d1fbc51 --- /dev/null +++ b/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md @@ -0,0 +1 @@ +- [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) diff --git a/tutorandroid/templates/android/build/Dockerfile b/tutorandroid/templates/android/build/Dockerfile index f74a3dd..b2bd950 100644 --- a/tutorandroid/templates/android/build/Dockerfile +++ b/tutorandroid/templates/android/build/Dockerfile @@ -35,8 +35,7 @@ RUN yes | /app/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOM FROM base AS code # Install android app repo ARG ANDROID_APP_REPOSITORY=https://github.com/openedx/openedx-app-android.git -# Always use the 'main' branch -ARG ANDROID_APP_VERSION=main +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 13e384484b6270ae2eac3e7375ba44aed7d21e3c Mon Sep 17 00:00:00 2001 From: Max Sokolski Date: Tue, 11 Jun 2024 10:19:50 +0300 Subject: [PATCH 3/4] feat: apply a new configuration template file (#22) Source: https://github.com/openedx/openedx-app-android/blob/main/default_config/prod/config.yaml --- .../20240610_132027_cmltawt0_fix_config.md | 1 + .../templates/android/build/config/tutor.yaml | 87 ++++++++++++++++--- 2 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 changelog.d/20240610_132027_cmltawt0_fix_config.md diff --git a/changelog.d/20240610_132027_cmltawt0_fix_config.md b/changelog.d/20240610_132027_cmltawt0_fix_config.md new file mode 100644 index 0000000..8ab9ad9 --- /dev/null +++ b/changelog.d/20240610_132027_cmltawt0_fix_config.md @@ -0,0 +1 @@ +- [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). diff --git a/tutorandroid/templates/android/build/config/tutor.yaml b/tutorandroid/templates/android/build/config/tutor.yaml index d5ecc8d..c284cba 100644 --- a/tutorandroid/templates/android/build/config/tutor.yaml +++ b/tutorandroid/templates/android/build/config/tutor.yaml @@ -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 \ No newline at end of file + 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 From e35b24fd5301a3b7cdf048c58eb754e206eeec4b Mon Sep 17 00:00:00 2001 From: Syed Muhammad Dawoud Sheraz Ali Date: Fri, 14 Jun 2024 22:51:22 +0500 Subject: [PATCH 4/4] v18.0.0 --- .github/workflows/test.yml | 13 ++++++++----- CHANGELOG.md | 10 ++++++++++ changelog.d/20240212_115536_regis_pkg_resources.md | 1 - ...2_hamzashafique_update_dependencies_new_repos.md | 1 - changelog.d/20240610_132027_cmltawt0_fix_config.md | 1 - ...hamzashafiquehere_dynamic_android_app_version.md | 1 - setup.py | 4 ++-- tutorandroid/__about__.py | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) delete mode 100644 changelog.d/20240212_115536_regis_pkg_resources.md delete mode 100644 changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md delete mode 100644 changelog.d/20240610_132027_cmltawt0_fix_config.md delete mode 100644 changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 829f613..c1c2821 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,16 +7,19 @@ on: jobs: tests: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.12'] steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Upgrade pip run: python -m pip install --upgrade pip setuptools - name: Install dependencies run: | pip install .[dev] - name: Test lint, types, and format - run: make test + run: make test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c82665b..26b1abb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,16 @@ instructions, because git commits are used to generate release notes: + +## 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) + + ## v17.0.0 (2023-12-09) diff --git a/changelog.d/20240212_115536_regis_pkg_resources.md b/changelog.d/20240212_115536_regis_pkg_resources.md deleted file mode 100644 index 35b6d20..0000000 --- a/changelog.d/20240212_115536_regis_pkg_resources.md +++ /dev/null @@ -1 +0,0 @@ -- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb) diff --git a/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md b/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md deleted file mode 100644 index 781dc8a..0000000 --- a/changelog.d/20240605_161642_hamzashafique_update_dependencies_new_repos.md +++ /dev/null @@ -1 +0,0 @@ -- [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) diff --git a/changelog.d/20240610_132027_cmltawt0_fix_config.md b/changelog.d/20240610_132027_cmltawt0_fix_config.md deleted file mode 100644 index 8ab9ad9..0000000 --- a/changelog.d/20240610_132027_cmltawt0_fix_config.md +++ /dev/null @@ -1 +0,0 @@ -- [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). diff --git a/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md b/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md deleted file mode 100644 index d1fbc51..0000000 --- a/changelog.d/20240610_212617_hamzashafiquehere_dynamic_android_app_version.md +++ /dev/null @@ -1 +0,0 @@ -- [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) diff --git a/setup.py b/setup.py index c4d97c3..cfd32cf 100644 --- a/setup.py +++ b/setup.py @@ -43,8 +43,8 @@ def load_about(): packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.8", - install_requires=["tutor>=17.0.0,<18.0.0"], - extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]}, + install_requires=["tutor>=18.0.0,<19.0.0"], + extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]}, entry_points={ "tutor.plugin.v1": [ "android = tutorandroid.plugin" diff --git a/tutorandroid/__about__.py b/tutorandroid/__about__.py index a08b09c..c6a8b8e 100644 --- a/tutorandroid/__about__.py +++ b/tutorandroid/__about__.py @@ -1 +1 @@ -__version__ = "17.0.0" +__version__ = "18.0.0"