Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3011b7fa authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

chore: Setup modules spotless, telemetry for /e/OS features

parent 459f1029
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,4 +54,5 @@ proguard-project.txt
# Android Studio/IDEA
*.iml
.idea

.kotlin
+26 −1
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

stages:
  - quality
  - build

variables:
  SENTRY_DSN: $SENTRY_DSN

before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
@@ -12,10 +16,31 @@ cache:
  paths:
  - .gradle/

quality:
  stage: quality
  script:
    - ./gradlew spotlessCheck
    - ./gradlew :notificationsreceiver:testDebugUnitTest :notificationsreceiver-domain:test
    - ./gradlew :app:assembleFdroidRelease
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: on_success
    - if: $CI_COMMIT_BRANCH == "main"
      when: on_success
    - when: never
  artifacts:
    paths:
      - ./**/build/reports/tests/testDebugUnitTest
      - app/build/outputs/apk/

buildRelease:
  stage: build
  script:
    - ./gradlew assembleFdroid
  rules:
    - if: $CI_COMMIT_BRANCH == "main"
      when: manual
    - when: never
  artifacts:
    paths:
      - app/build/outputs/apk/fdroid/release
+37 −0
Original line number Diff line number Diff line
# foundation.e.ntfy

Fork of [ntfy-android](https://github.com/binwiederhier/ntfy-android) app. It is used in /e/OS as the default UnifiedPush distributor client, and to implement the /e/OS Broadcasting notification feature. It allows to /e/OS user to receive news and alerts from /e/OS team. 

##  /e/OS Development

Add quality hooks, to avoid quality job failure when creating MR. Create the .git/hooks/pre-push
file make it executable, and add the gradle tasks set in quality job in .gitlab.ci file:

̀```shell
#!/bin/sh

./gradlew spotlessCheck && ./gradlew :notificationsreceiver:testDebugUnitTest :notificationsreceiver-domain:test

̀```
## Software architecture and good practices for /e/OS related upgrades

Feature addition are located in dedicated modules and follow a clean architecture to guide code split and simplify Unit tests writing and maintenance.

### notificationsreceiver-domain
The domain module is a pure kotlin module, to simplify unit tests. UseCase can use Entities and Procedures to implement the fonctionnalities to the user. Procedures may implement pure technical routines to.

The goal is to maximise the features related or delicate code in the domain module, and unit test it. Then other module host mostly interfaces adapters with boiler plate code, where unit test make less sense.

### notificationsreceiver-bridges

This module hold interfaces adapter between Android specific features and the domain module.

### notificationsreceiver-UI

Ui use compose

### foundation.e.notificationsreceiver in app module

Hold glue code, which has to belong in main app module.


# ntfy Android App
This is the Android app for [ntfy](https://github.com/binwiederhier/ntfy) ([ntfy.sh](https://ntfy.sh)). You can find the app in [F-Droid](https://f-droid.org/packages/io.heckel.ntfy/) or the [Play Store](https://play.google.com/store/apps/details?id=io.heckel.ntfy), 
or as .apk files on the [releases page](https://github.com/binwiederhier/ntfy-android/releases).
+24 −2
Original line number Diff line number Diff line
plugins {
    id 'com.google.devtools.ksp'
    alias(libs.plugins.hilt.android)
}

repositories {
@@ -20,7 +21,7 @@ android {

    defaultConfig {
        applicationId "foundation.e.ntfy"
        minSdkVersion 21
        minSdkVersion 31
        targetSdkVersion 35

        versionCode versionMajor * 100000000 + versionMinor * 100000 + versionPatch * 100 + eOSPatch
@@ -36,6 +37,18 @@ android {
        buildFeatures {
            buildConfig true
        }

        def sentryDSN = System.getenv("SENTRY_DSN") ?: "placeholdertoto"
        buildConfigField("String", "SENTRY_DSN", "\"$sentryDSN\"")
    }

    signingConfigs {
        create("platform-test") {
            storeFile = file("$rootDir/ci/platform.jks")
            storePassword = "platform"
            keyAlias = "platform"
            keyPassword = "platform"
        }
    }

    buildTypes {
@@ -43,12 +56,14 @@ android {
            minifyEnabled false
            shrinkResources false
            debuggable false
            signingConfig = null
        }
        debug {
            minifyEnabled false
            shrinkResources false
            debuggable true
            applicationIdSuffix ".debug"
            signingConfig = signingConfigs.getByName("platform-test")

            versionNameSuffix "-debug"
        }
    }
@@ -104,6 +119,13 @@ android.applicationVariants.all { variant ->
}

dependencies {
    implementation project(":notificationsreceiver-domain")
    implementation project(':notificationsreceiver')

    implementation(libs.dagger.hilt.android)
    ksp(libs.dagger.hilt.compiler)
    implementation(libs.eos.telemetry)

    // AndroidX, The Basics
    implementation "androidx.appcompat:appcompat:1.6.1"
    implementation "androidx.core:core-ktx:1.10.1"
+1 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name" translatable="false">ntfy (debug)</string>
    <string name="app_base_url" translatable="false">https://push.murenatest.com</string>
</resources>
Loading