1
0
mirror of https://github.com/stom79/exodus-android-app synced 2024-12-11 08:15:28 +01:00

Create flavor for fdroid & google as not the same permission is used.

This commit is contained in:
Thomas 2021-01-11 11:38:08 +01:00
parent 6b5631bb43
commit 90848c678a
6 changed files with 60 additions and 29 deletions

View File

@ -28,26 +28,56 @@ android {
}
productFlavors {
exodus {
exodus_google {
applicationId "org.eu.exodus_privacy.exodusprivacy"
buildConfigField "boolean", "amal", "false"
}
amal {
amal_google {
applicationId "app.fedilab.amal"
buildConfigField "boolean", "amal", "true"
}
fedilab {
fedilab_google {
applicationId "app.fedilab.exodusprivacy"
buildConfigField "boolean", "amal", "false"
}
exodus_fdroid {
applicationId "org.eu.exodus_privacy.exodusprivacy"
buildConfigField "boolean", "amal", "false"
}
amal_fdroid {
applicationId "app.fedilab.amal"
buildConfigField "boolean", "amal", "true"
}
fedilab_fdroid {
applicationId "app.fedilab.exodusprivacy"
buildConfigField "boolean", "amal", "false"
}
}
sourceSets {
exodus {
exodus_google {
res.srcDirs = ['src/main/res', 'src/exodus/res']
manifest.srcFile 'src/google/AndroidManifest.xml'
}
fedilab {
fedilab_google {
res.srcDirs = ['src/main/res', 'src/fedilab/res']
manifest.srcFile 'src/google/AndroidManifest.xml'
}
amal {
amal_google {
res.srcDirs = ['src/main/res', 'src/amal/res']
manifest.srcFile 'src/google/AndroidManifest.xml'
}
exodus_fdroid {
res.srcDirs = ['src/main/res', 'src/exodus/res']
manifest.srcFile 'src/fdroid/AndroidManifest.xml'
}
fedilab_fdroid {
res.srcDirs = ['src/main/res', 'src/fedilab/res']
manifest.srcFile 'src/fdroid/AndroidManifest.xml'
}
amal_fdroid {
res.srcDirs = ['src/main/res', 'src/amal/res']
manifest.srcFile 'src/fdroid/AndroidManifest.xml'
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.eu.exodus_privacy.exodusprivacy">
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
</manifest>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eu.exodus_privacy.exodusprivacy">
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
</manifest>

View File

@ -3,13 +3,10 @@
xmlns:tools="http://schemas.android.com/tools"
package="org.eu.exodus_privacy.exodusprivacy">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"

View File

@ -104,10 +104,11 @@ public class CheckAppActivity extends AppCompatActivity implements NetworkListen
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(CheckAppActivity.this);
dialogBuilder.setTitle(getString(R.string.app_not_analyzed_title));
dialogBuilder.setMessage(getString(R.string.app_not_analyzed));
//noinspection RedundantSuppression
dialogBuilder.setPositiveButton(R.string.submit, (dialog, id) -> {
Uri uri;
//noinspection ConstantConditions
if (BuildConfig.FLAVOR.equals("exodus")) {
if (!BuildConfig.amal) {
uri = Uri.parse("https://reports.exodus-privacy.eu.org/analysis/submit/#" + app_id);
} else {
uri = Uri.parse("https://exodus.phm.education.gouv.fr/analysis/submit/#" + app_id);

View File

@ -5,9 +5,7 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@ -32,7 +30,7 @@ public class Utils {
public static final String LAST_REFRESH = "last_refresh";
public static String getDomain() {
return BuildConfig.FLAVOR.compareTo("amal") == 0 ? "exodus.phm.education.gouv.fr" : "reports.exodus-privacy.eu.org";
return BuildConfig.amal ? "exodus.phm.education.gouv.fr" : "reports.exodus-privacy.eu.org";
}
@SuppressLint("PackageManagerGetSignatures")
@ -283,18 +281,4 @@ public class Utils {
}
return builder.toString();
}
/**
* Converts dp to pixel
*
* @param dp float - the value in dp to convert
* @param context Context
* @return float - the converted value in pixel
*/
public static float convertDpToPixel(float dp, Context context) {
Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics();
return dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT);
}
}