build: add F-Droid flavor (#760)

* build: add fdroid flavor

* feat: disable fcm registration in f-droid flavor
This commit is contained in:
FineFindus 2023-08-18 18:15:57 +02:00 committed by GitHub
parent a79779f813
commit 2ca34278f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,7 @@ android {
}
githubRelease { initWith release }
playRelease { initWith release }
fdroidRelease { initWith release }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17

View File

@ -122,6 +122,12 @@ public class PushSubscriptionManager{
public void registerAccountForPush(PushSubscription subscription){
// this function is used for registering push notifications using FCM
// to avoid NonFreeNet in F-Droid, this registration is disabled in it
// see https://github.com/LucasGGamerM/moshidon/issues/206 for more context
if(BuildConfig.BUILD_TYPE.equals("fdroidRelease"))
return;
if(TextUtils.isEmpty(deviceToken))
throw new IllegalStateException("No device push token available");
String endpoint = "https://app.joinmastodon.org/relay-to/fcm/"+deviceToken+"/"+accountID;