Merge pull request #5541 from ByteHamster/debug-warning

Warn about using debug version
This commit is contained in:
ByteHamster 2021-11-09 23:40:32 +01:00 committed by GitHub
commit bae923d710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package de.danoeh.antennapod.fragment.preferences; package de.danoeh.antennapod.fragment.preferences;
import android.content.Intent; import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@ -42,15 +44,26 @@ public class MainPreferencesFragment extends PreferenceFragmentCompat {
// and afterwards remove the following lines. Please keep in mind that AntennaPod is licensed under the GPL. // and afterwards remove the following lines. Please keep in mind that AntennaPod is licensed under the GPL.
// This means that your application needs to be open-source under the GPL, too. // This means that your application needs to be open-source under the GPL, too.
// It must also include a prominent copyright notice. // It must also include a prominent copyright notice.
String packageName = getContext().getPackageName(); int packageHash = getContext().getPackageName().hashCode();
if (!"de.danoeh.antennapod".equals(packageName) && !"de.danoeh.antennapod.debug".equals(packageName)) { if (packageHash != 1790437538 && packageHash != -1190467065) {
findPreference(PREF_CATEGORY_PROJECT).setVisible(false); findPreference(PREF_CATEGORY_PROJECT).setVisible(false);
Preference copyrightNotice = new Preference(getContext()); Preference copyrightNotice = new Preference(getContext());
copyrightNotice.setIcon(R.drawable.ic_info_white);
copyrightNotice.getIcon().mutate()
.setColorFilter(new PorterDuffColorFilter(0xffcc0000, PorterDuff.Mode.MULTIPLY));
copyrightNotice.setSummary("This application is based on AntennaPod." copyrightNotice.setSummary("This application is based on AntennaPod."
+ " The AntennaPod team does NOT provide support for this unofficial version." + " The AntennaPod team does NOT provide support for this unofficial version."
+ " If you can read this message, the developers of this modification" + " If you can read this message, the developers of this modification"
+ " violate the GNU General Public License (GPL)."); + " violate the GNU General Public License (GPL).");
findPreference(PREF_CATEGORY_PROJECT).getParent().addPreference(copyrightNotice); findPreference(PREF_CATEGORY_PROJECT).getParent().addPreference(copyrightNotice);
} else if (packageHash == -1190467065) {
Preference debugNotice = new Preference(getContext());
debugNotice.setIcon(R.drawable.ic_info_white);
debugNotice.getIcon().mutate()
.setColorFilter(new PorterDuffColorFilter(0xffcc0000, PorterDuff.Mode.MULTIPLY));
debugNotice.setOrder(-1);
debugNotice.setSummary("This is a development version of AntennaPod and not meant for daily use");
findPreference(PREF_CATEGORY_PROJECT).getParent().addPreference(debugNotice);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB