Loading .gitlab-ci.yml +8 −3 Original line number Diff line number Diff line image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release variables: SENTRY_DSN: $SENTRY_DSN stages: - debug - release Loading Loading @@ -68,6 +71,8 @@ buildRelease: when: always - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: always - if: '$CI_COMMIT_TAG !~ "/^$/"' when: always script: - ./gradlew assembleRelease artifacts: Loading Loading @@ -144,8 +149,8 @@ pushToPrebuilt: - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - git config user.email "gitlab@e.foundation" - git config user.name "gitlab" - git config --global user.email "gitlab@e.foundation" - git config --global user.name "gitlab" script: - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") Loading @@ -159,7 +164,7 @@ pushToPrebuilt: - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk - git add Apps - git status - git commit -m "Update Apps Lounge apk to ${NEW_APK_VERSION}\nFrom ${CI_COMMIT_SHA}" - git commit -m "Apps Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" - git push # Sometimes a single push doesn't do all the job, so we have to push twice - git push No newline at end of file app/build.gradle +18 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,21 @@ def getDate = { -> return new Date().format('yyyyMMddHHmmss') } def getSentryDsn = { -> def sentryDsnEnv = System.getenv("SENTRY_DSN") if (sentryDsnEnv != null) { return sentryDsnEnv } Properties properties = new Properties() def propertiesFile = project.rootProject.file('local.properties') if (propertiesFile.exists()) { properties.load(propertiesFile.newDataInputStream()) } return properties.getProperty('SENTRY_DSN') } android { compileSdk 31 Loading @@ -37,6 +52,7 @@ android { versionName "${versionMajor}.${versionMinor}.${versionPatch}" buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\"" buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } Loading Loading @@ -133,6 +149,8 @@ dependencies { // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628 api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.4-alpha' implementation 'foundation.e:gplayapi:3.0.1' implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.1' Loading Loading @@ -229,9 +247,6 @@ dependencies { // JSoup implementation 'org.jsoup:jsoup:1.13.1' // Flow reactive network implementation 'ru.beryukhov:flowreactivenetwork:1.0.4' // elib implementation 'foundation.e:elib:0.0.1-alpha11' } app/src/main/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ android:supportsRtl="true" android:theme="@style/Theme.Apps" android:usesCleartextTraffic="true"> <activity android:name=".MainActivity" android:exported="true"> Loading app/src/main/java/foundation/e/apps/AppLoungeApplication.kt +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import foundation.e.apps.manager.pkg.PkgManagerModule import foundation.e.apps.manager.workmanager.InstallWorkManager import foundation.e.apps.setup.tos.TOS_VERSION import foundation.e.apps.utils.modules.DataStoreModule import foundation.e.lib.telemetry.Telemetry import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch Loading Loading @@ -63,14 +64,20 @@ class AppLoungeApplication : Application(), Configuration.Provider { dataStoreModule.saveTOCStatus(false, "") } } if (BuildConfig.DEBUG) { plant(Timber.DebugTree()) } else { // Allow enabling telemetry only for release builds. Telemetry.init(BuildConfig.SENTRY_DSN, this) plant(object : Timber.Tree() { override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { if (priority == Log.DEBUG || priority == Log.VERBOSE) { if (priority < Log.WARN) { return } if (priority == Log.ERROR) { Telemetry.reportMessage("$tag: $message") } Log.println(priority, tag, message) } }) Loading app/src/main/java/foundation/e/apps/MainActivity.kt +3 −1 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ class MainActivity : AppCompatActivity() { } } viewModel.setupConnectivityManager(this) viewModel.internetConnection.observe(this) { isInternetAvailable -> hasInternet = isInternetAvailable if (isInternetAvailable) { Loading Loading @@ -205,7 +207,7 @@ class MainActivity : AppCompatActivity() { } } if (!CommonUtilsModule.isNetworkAvailable(this)) { if (viewModel.internetConnection.value != true) { showNoInternet() } Loading Loading
.gitlab-ci.yml +8 −3 Original line number Diff line number Diff line image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release variables: SENTRY_DSN: $SENTRY_DSN stages: - debug - release Loading Loading @@ -68,6 +71,8 @@ buildRelease: when: always - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: always - if: '$CI_COMMIT_TAG !~ "/^$/"' when: always script: - ./gradlew assembleRelease artifacts: Loading Loading @@ -144,8 +149,8 @@ pushToPrebuilt: - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - git config user.email "gitlab@e.foundation" - git config user.name "gitlab" - git config --global user.email "gitlab@e.foundation" - git config --global user.name "gitlab" script: - NEW_APK_NAME=$(basename ${NEW_APK_PATH}*-release.apk) - NEW_APK_VERSION=$(awk -F '-' '{print $2}' <<< "$NEW_APK_NAME") Loading @@ -159,7 +164,7 @@ pushToPrebuilt: - sed -i "6s/.*/LOCAL_SRC_FILES := ${NEW_APK_NAME}/" Apps/Android.mk - git add Apps - git status - git commit -m "Update Apps Lounge apk to ${NEW_APK_VERSION}\nFrom ${CI_COMMIT_SHA}" - git commit -m "Apps Lounge - ${NEW_APK_VERSION}, ${CI_COMMIT_TAG}" -m "From ${CI_COMMIT_SHA}, pipeline ${CI_PIPELINE_ID}" - git push # Sometimes a single push doesn't do all the job, so we have to push twice - git push No newline at end of file
app/build.gradle +18 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,21 @@ def getDate = { -> return new Date().format('yyyyMMddHHmmss') } def getSentryDsn = { -> def sentryDsnEnv = System.getenv("SENTRY_DSN") if (sentryDsnEnv != null) { return sentryDsnEnv } Properties properties = new Properties() def propertiesFile = project.rootProject.file('local.properties') if (propertiesFile.exists()) { properties.load(propertiesFile.newDataInputStream()) } return properties.getProperty('SENTRY_DSN') } android { compileSdk 31 Loading @@ -37,6 +52,7 @@ android { versionName "${versionMajor}.${versionMinor}.${versionPatch}" buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\"" buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } Loading Loading @@ -133,6 +149,8 @@ dependencies { // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628 api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.4-alpha' implementation 'foundation.e:gplayapi:3.0.1' implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.1' Loading Loading @@ -229,9 +247,6 @@ dependencies { // JSoup implementation 'org.jsoup:jsoup:1.13.1' // Flow reactive network implementation 'ru.beryukhov:flowreactivenetwork:1.0.4' // elib implementation 'foundation.e:elib:0.0.1-alpha11' }
app/src/main/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ android:supportsRtl="true" android:theme="@style/Theme.Apps" android:usesCleartextTraffic="true"> <activity android:name=".MainActivity" android:exported="true"> Loading
app/src/main/java/foundation/e/apps/AppLoungeApplication.kt +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import foundation.e.apps.manager.pkg.PkgManagerModule import foundation.e.apps.manager.workmanager.InstallWorkManager import foundation.e.apps.setup.tos.TOS_VERSION import foundation.e.apps.utils.modules.DataStoreModule import foundation.e.lib.telemetry.Telemetry import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch Loading Loading @@ -63,14 +64,20 @@ class AppLoungeApplication : Application(), Configuration.Provider { dataStoreModule.saveTOCStatus(false, "") } } if (BuildConfig.DEBUG) { plant(Timber.DebugTree()) } else { // Allow enabling telemetry only for release builds. Telemetry.init(BuildConfig.SENTRY_DSN, this) plant(object : Timber.Tree() { override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { if (priority == Log.DEBUG || priority == Log.VERBOSE) { if (priority < Log.WARN) { return } if (priority == Log.ERROR) { Telemetry.reportMessage("$tag: $message") } Log.println(priority, tag, message) } }) Loading
app/src/main/java/foundation/e/apps/MainActivity.kt +3 −1 Original line number Diff line number Diff line Loading @@ -104,6 +104,8 @@ class MainActivity : AppCompatActivity() { } } viewModel.setupConnectivityManager(this) viewModel.internetConnection.observe(this) { isInternetAvailable -> hasInternet = isInternetAvailable if (isInternetAvailable) { Loading Loading @@ -205,7 +207,7 @@ class MainActivity : AppCompatActivity() { } } if (!CommonUtilsModule.isNetworkAvailable(this)) { if (viewModel.internetConnection.value != true) { showNoInternet() } Loading