mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.25k stars 1.37k forks source link

Publish app on f-droid #566

Closed sedrubal closed 1 year ago

sedrubal commented 7 years ago

Summary

Some users don't have google play store but f-droid. Is it possible to provide free builds (with only free and open source libraries)? I don't know if it's possible to build this app with the tools provided by f-droid...

licaon-kter commented 1 year ago

Started to update the recipe for 2.0.0 (fyi 1.56.0 builds fine):

  - versionName: 2.0.0
    versionCode: 446
    commit: ca1f6df1c65f1f0609874afbbd9fd83dfb4d9a51
    subdir: android/app
    sudo:
      - sdkmanager 'build-tools;31.0.0' 'build-tools;30.0.3'
      - cp /opt/android-sdk/build-tools/30.0.3/lib/dx.jar /opt/android-sdk/build-tools/31.0.0/lib/dx.jar
      - cp /opt/android-sdk/build-tools/30.0.3/dx /opt/android-sdk/build-tools/31.0.0/dx
      - sysctl fs.inotify.max_user_watches=524288 || true
      - curl -Lo node.tar.gz https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.gz
      - echo "a8fcacb8033504e6d704bdee821f7005ee3774db25c799bcf2a13b5bda7de172  node.tar.gz"
        | sha256sum -c -
      - tar xzf node.tar.gz --strip-components=1 -C /usr/local/
      - npm -g install yarn
      - npm -g install npm@7
    init:
      - cd ../..
      - sed -i -e '/react-native-youtube/d' -e 's|git://github.com/||' package.json
      - sed -i -e "/fs.existsSync('dist')/,+2d" scripts/generate-assets.js
      - mkdir -p dist/assets
      - sed -i -e '/mmjstool":\ {/,/^    },/d' package-lock.json
      - npm install --ignore-scripts
    gradle:
      - yes
    srclibs:
      - react-native-reanimated@2.13.0
    rm:
      - ios
      - app/components/post_list/post/body/content/youtube/
      - node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/fcm/FcmInstanceIdListenerService.java
      - node_modules/react-native/sdks/hermesc/win64-bin
    prebuild:
      - sed -i -e '/gms/d' ../build.gradle build.gradle
      - sed -i -e 's|$rootDir.*Detox-android|https://jitpack.io|' ../build.gradle
      - sed -i -e '/bundleCommand/a nodeExecutableAndArgs:["node","--max-old-space-size=12000"],'
        -e '/firebase/d' -e '/detox/d' build.gradle
      - cd ../..
      - npx patch-package --error-on-fail
      - sed -i -e '/if (isYoutubeLink/,/^\s\{8\}}/d' -e '/YouTube/d' app/components/post_list/post/body/content/index.tsx
      - sed -i -e "/dependencies {/aimplementation 'im.conversations.webrtc:webrtc-android:104.0.0'"
        node_modules/react-native-webrtc/android/build.gradle
      - sed -i -e '/bintray/d' node_modules/@rudderstack/rudder-sdk-react-native/android/build.gradle
      - sed -E -i '/installreferrer/,+11d' node_modules/react-native-device-info/android/build.gradle
      - sed -i -e 's|maven.fabric.io/public|jitpack.io|' node_modules/react-native-math-view/android/build.gradle
      - cp node_modules/@mattermost/compass-icons/font/compass-icons.ttf assets/fonts/
      - cp node_modules/@mattermost/compass-icons/font/compass-icons.ttf android/app/src/main/assets/fonts
      - cd node_modules/react-native-notifications/lib/android/app
      - sed -i -e '/firebase-messaging/d' build.gradle
      - sed -i -e '/google-services/d' ../build.gradle
      - sed -i -e '/FcmInstanceIdListenerService/,/<service/d' src/main/AndroidManifest.xml
      - sed -i -e '/FirebaseApp/d' src/main/java/com/wix/reactnativenotifications/RNNotificationsPackage.java
      - sed -i -e '/FirebaseMessaging.getInstance/,/});/d' -e '/FirebaseMessaging/d'
        src/main/java/com/wix/reactnativenotifications/fcm/FcmToken.java
    scanignore:
      - android/build.gradle
      - node_modules/jsc-android
      - node_modules/react-native/android
      - node_modules/@react-native-community/netinfo/android/build.gradle
      - node_modules/react-native-document-picker/android/build.gradle
      - node_modules/react-native-device-info/android/build.gradle
      - node_modules/react-native-localize/android/build.gradle
      - node_modules/react-native-navigation/lib/android/build.gradle
      - node_modules/react-native-notifications/lib/android/build.gradle
      - node_modules/react-native-permissions/android/build.gradle
      - node_modules/react-native-safe-area-context/android/build.gradle
      - node_modules/react-native-screens/android/build.gradle
      - node_modules/react-native-share/android/build.gradle
      - node_modules/react-native-svg/android/build.gradle
      - node_modules/react-native-vector-icons/android/build.gradle
      - node_modules/react-native-webview/android/build.gradle
      - node_modules/detox/android/build.gradle
      - node_modules/detox/android/detox/publishing.gradle
      - node_modules/@mattermost/react-native-paste-input/android/build.gradle
      - node_modules/@react-native-cookies/cookies/android/build.gradle
      - node_modules/react-native-math-view/android/build.gradle
      - node_modules/react-native-fast-image/android/build.gradle
      - node_modules/react-native/ReactAndroid/build.gradle
      - node_modules/@mattermost/react-native-emm/android/build.gradle
      - node_modules/@mattermost/react-native-network-client/android/build.gradle
      - node_modules/@mattermost/react-native-turbo-log/android/build.gradle
      - node_modules/@mattermost/react-native-turbo-mailer/android/build.gradle
      - node_modules/@react-native-camera-roll/camera-roll/android/build.gradle
      - node_modules/react-native-create-thumbnail/android/build.gradle
      - node_modules/react-native-in-app-review/android/build.gradle
      - node_modules/react-native-linear-gradient/android/build.gradle
      - node_modules/react-native/ReactAndroid/hermes-engine/build.gradle
      - node_modules/react-native-reanimated/android/build.gradle
      - node_modules/react-native/template/android/build.gradle
      - node_modules/@stream-io/flat-list-mvcp/android/build.gradle
    scandelete:
      - node_modules
    build:
      - pushd ../..
      - node scripts/generate-assets.js
      - ./node_modules/.bin/jetify
      - popd
      - pushd $$react-native-reanimated$$
      - yarn add react-native@0.70.6
      - gradle :assembleRelease
      - popd
      - mv $$react-native-reanimated$$/build/outputs/aar/android-release.aar ../../node_modules/react-native-reanimated/android/react-native-reanimated-70-jsc.aar
    ndk: r21e

but I had to stop since react-native-in-app-review depends on non-FOSS libs: https://github.com/MinaSamir11/react-native-in-app-review/blob/master/android/build.gradle#L56-L57

Also this fail when building reanimated

> Task :verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/home/vagrant/build/srclib/react-native-reanimated/android/build/intermediates/merged_res/release/values/values.xml:2732: AAPT: error: resource android:attr/lStar not found.
licaon-kter commented 1 year ago

2.0.0 will come to F-Droid soon thanks to @linsui , but not recommended yet so users are not updated unless they opted in for "unstable versions" or "beta versions (F-Droid Client 1.16)". Will promote to recommended when this is tagged here (feel free to ping us).

Of note, we've also split the APK into "per arch" APKs so each is now 50Mb or less. For this to work we've bumped versionCode as versionCode * 100 + arch, eg. arm64 ends up as 44903

ref: https://gitlab.com/fdroid/fdroiddata/-/commit/7c0f7023efb492171a229db587cab681824b8494

/LE: fix typo

licaon-kter commented 1 year ago

Tagged and updated recipe: https://gitlab.com/fdroid/fdroiddata/-/commit/7297f48cfe8eb6ef90af5369f2fd35d528688849

okias commented 1 year ago

I assume this can be closed as DONE? https://f-droid.org/en/packages/com.mattermost.rnbeta/

larkox commented 1 year ago

We're excited to see our app on f-droid; however, the f-droid version is community maintained and not officially supported or tested by Mattermost. You are most welcome to discuss this on the Mattermost Community Server (we have an f-droid channel), and we encourage you to share f-droid updates on the Mattermost Discussion Forum site.

With all that being said, since the objective of this issue seems met, and I see agreement on the thread, I will mark it as done.

licaon-kter commented 1 year ago

however, the f-droid version is community maintained and not officially supported or tested by Mattermost.

Does that mean you'll clean up a flavor that won't be .beta and will be official soon? :)

larkox commented 1 year ago

@licaon-kter sadly, quite the opposite I guess :sweat_smile:

einarpersson commented 9 months ago

Could the apk be published (signed) directly in the repo/releases so that you can install with Obtainium without f-droid even?

licaon-kter commented 9 months ago

@einarpersson you mean with Google proprietary libs?

einarpersson commented 9 months ago

Sorry I am a bit new to the android ecosystem. I guess I am talking about the version that is published on f droid? But I now understand that that is an unofficial fork right now.

Anyhow: The reason I wanted Mattermost for my team(s) was to get away from Slack, Google etc. as much as possible. I cannot imagine I am the only one thinking like that. And then being able to use something like Obtainium to install apps (like Mattermost) directly from repository is exactly what I want.

licaon-kter commented 9 months ago

I guess I am talking about the version that is published on f droid?

As the issue title says...

But you can always get Mattermost from F-Droid directly, why install Obtainium but not F-Droid Client instead? :slightly_smiling_face:

But I now understand that that is an unofficial fork right now.

It is, because F-Droid cleans up non-FOSS libs by Google used for Push and etc