support OpenCollective as a donation option
This commit is contained in:
parent
35d2047536
commit
1061929fb4
@ -165,6 +165,8 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
|
||||
public String liberapayID;
|
||||
|
||||
public String openCollective;
|
||||
|
||||
/**
|
||||
* This matches {@code CurrentVersion} in build metadata files.
|
||||
*
|
||||
@ -312,6 +314,9 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
case Cols.LIBERAPAY_ID:
|
||||
liberapayID = cursor.getString(i);
|
||||
break;
|
||||
case Cols.OPEN_COLLECTIVE:
|
||||
openCollective = cursor.getString(i);
|
||||
break;
|
||||
case Cols.AutoInstallApk.VERSION_NAME:
|
||||
autoInstallVersionName = cursor.getString(i);
|
||||
break;
|
||||
@ -991,6 +996,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
values.put(Cols.LITECOIN, litecoin);
|
||||
values.put(Cols.FLATTR_ID, flattrID);
|
||||
values.put(Cols.LIBERAPAY_ID, liberapayID);
|
||||
values.put(Cols.OPEN_COLLECTIVE, openCollective);
|
||||
values.put(Cols.ADDED, Utils.formatDate(added, ""));
|
||||
values.put(Cols.LAST_UPDATED, Utils.formatDate(lastUpdated, ""));
|
||||
values.put(Cols.PREFERRED_SIGNER, preferredSigner);
|
||||
@ -1104,6 +1110,12 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
return TextUtils.isEmpty(bitcoin) ? null : "litecoin:" + bitcoin;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getOpenCollectiveUri() {
|
||||
return TextUtils.isEmpty(openCollective) ? null : "https://opencollective.com/"
|
||||
+ openCollective + "/donate/";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getFlattrUri() {
|
||||
return TextUtils.isEmpty(flattrID) ? null : "https://flattr.com/thing/" + flattrID;
|
||||
@ -1220,6 +1232,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
dest.writeString(this.litecoin);
|
||||
dest.writeString(this.flattrID);
|
||||
dest.writeString(this.liberapayID);
|
||||
dest.writeString(this.openCollective);
|
||||
dest.writeString(this.preferredSigner);
|
||||
dest.writeString(this.suggestedVersionName);
|
||||
dest.writeInt(this.suggestedVersionCode);
|
||||
@ -1271,6 +1284,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
this.litecoin = in.readString();
|
||||
this.flattrID = in.readString();
|
||||
this.liberapayID = in.readString();
|
||||
this.openCollective = in.readString();
|
||||
this.preferredSigner = in.readString();
|
||||
this.suggestedVersionName = in.readString();
|
||||
this.suggestedVersionCode = in.readInt();
|
||||
|
@ -157,6 +157,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
+ AppMetadataTable.Cols.LITECOIN + " string,"
|
||||
+ AppMetadataTable.Cols.FLATTR_ID + " string,"
|
||||
+ AppMetadataTable.Cols.LIBERAPAY_ID + " string,"
|
||||
+ AppMetadataTable.Cols.OPEN_COLLECTIVE + " string,"
|
||||
+ AppMetadataTable.Cols.REQUIREMENTS + " string,"
|
||||
+ AppMetadataTable.Cols.ADDED + " string,"
|
||||
+ AppMetadataTable.Cols.LAST_UPDATED + " string,"
|
||||
@ -227,7 +228,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
+ "primary key(" + ApkAntiFeatureJoinTable.Cols.APK_ID + ", " + ApkAntiFeatureJoinTable.Cols.ANTI_FEATURE_ID + ") "
|
||||
+ " );";
|
||||
|
||||
protected static final int DB_VERSION = 84;
|
||||
protected static final int DB_VERSION = 85;
|
||||
|
||||
private final Context context;
|
||||
|
||||
@ -457,6 +458,20 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
addTranslation(db, oldVersion);
|
||||
switchRepoArchivePriorities(db, oldVersion);
|
||||
deleteOldIconUrls(db, oldVersion);
|
||||
addOpenCollective(db, oldVersion);
|
||||
}
|
||||
|
||||
private void addOpenCollective(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion >= 85) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.OPEN_COLLECTIVE)) {
|
||||
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.OPEN_COLLECTIVE + " field to "
|
||||
+ AppMetadataTable.NAME + " table in db.");
|
||||
db.execSQL("alter table " + AppMetadataTable.NAME + " add column "
|
||||
+ AppMetadataTable.Cols.OPEN_COLLECTIVE + " string;");
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteOldIconUrls(SQLiteDatabase db, int oldVersion) {
|
||||
|
@ -190,6 +190,7 @@ public interface Schema {
|
||||
String LITECOIN = "litecoinAddr";
|
||||
String FLATTR_ID = "flattrID";
|
||||
String LIBERAPAY_ID = "liberapayID";
|
||||
String OPEN_COLLECTIVE = "openCollective";
|
||||
String PREFERRED_SIGNER = "preferredSigner";
|
||||
String AUTO_INSTALL_VERSION_CODE = "suggestedVercode"; // name mismatch from issue #1063
|
||||
String SUGGESTED_VERSION_NAME = "upstreamVersion"; // name mismatch from issue #1063
|
||||
@ -244,7 +245,7 @@ public interface Schema {
|
||||
ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
|
||||
TRANSLATION, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
SUGGESTED_VERSION_NAME, SUGGESTED_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
OPEN_COLLECTIVE, SUGGESTED_VERSION_NAME, SUGGESTED_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
||||
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
||||
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
||||
@ -261,7 +262,7 @@ public interface Schema {
|
||||
_ID, ROW_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
|
||||
TRANSLATION, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
SUGGESTED_VERSION_NAME, SUGGESTED_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
OPEN_COLLECTIVE, SUGGESTED_VERSION_NAME, SUGGESTED_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
||||
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
||||
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
||||
|
@ -796,6 +796,11 @@ public class AppDetailsRecyclerViewAdapter
|
||||
addDonateOption(R.layout.donate_liberapay, app.getLiberapayUri());
|
||||
}
|
||||
|
||||
// OpenCollective
|
||||
if (uriIsSetAndCanBeOpened(app.getOpenCollectiveUri())) {
|
||||
addDonateOption(R.layout.donate_opencollective, app.getOpenCollectiveUri());
|
||||
}
|
||||
|
||||
// Bitcoin
|
||||
if (uriIsSetAndCanBeOpened(app.getBitcoinUri())) {
|
||||
addDonateOption(R.layout.donate_bitcoin, app.getBitcoinUri());
|
||||
|
34
app/src/main/res/drawable/donation_option_opencollective.xml
Normal file
34
app/src/main/res/drawable/donation_option_opencollective.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="300dp"
|
||||
android:height="50dp"
|
||||
android:viewportWidth="300"
|
||||
android:viewportHeight="50">
|
||||
<path
|
||||
android:pathData="M25.806,0.226L275.806,0.226A24,24 0,0 1,299.806 24.226L299.806,24.226A24,24 0,0 1,275.806 48.226L25.806,48.226A24,24 0,0 1,1.806 24.226L1.806,24.226A24,24 0,0 1,25.806 0.226z"
|
||||
android:fillType="evenOdd">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startY="2.1030872"
|
||||
android:startX="150.80646"
|
||||
android:endY="48.225807"
|
||||
android:endX="150.80646"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF7ACFFF"/>
|
||||
<item android:offset="1" android:color="#FF4CBEFF"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:pathData="M275.806,24.226m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M287.316,16.252C288.886,18.516 289.806,21.262 289.806,24.226c0,2.963 -0.92,5.71 -2.49,7.974L283.688,28.573C284.401,27.283 284.806,25.803 284.806,24.226 284.806,22.649 284.401,21.168 283.688,19.879l3.627,-3.627zM283.78,12.717 L280.153,16.345C278.863,15.631 277.383,15.226 275.806,15.226c-4.97,0 -9,4.03 -9,9 0,4.97 4.03,9 9,9 1.577,0 3.058,-0.405 4.347,-1.118l3.627,3.627C281.516,37.306 278.77,38.226 275.806,38.226 268.074,38.226 261.806,31.958 261.806,24.226 261.806,16.494 268.074,10.226 275.806,10.226c2.963,0 5.71,0.92 7.974,2.49z"
|
||||
android:fillColor="#3faff0"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M287.316,16.252C288.886,18.516 289.806,21.262 289.806,24.226c0,2.963 -0.92,5.71 -2.49,7.974L283.688,28.573C284.401,27.283 284.806,25.803 284.806,24.226 284.806,22.649 284.401,21.168 283.688,19.879l3.627,-3.627z"
|
||||
android:fillColor="#b8d5e6"
|
||||
android:fillType="evenOdd"/>
|
||||
</vector>
|
10
app/src/main/res/layout/donate_opencollective.xml
Normal file
10
app/src/main/res/layout/donate_opencollective.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:contentDescription="@string/menu_opencollective"
|
||||
android:src="@drawable/donation_option_opencollective" />
|
@ -234,6 +234,8 @@ This often occurs with apps installed via Google Play or other sources, if they
|
||||
<string name="menu_flattr">Flattr</string>
|
||||
<!-- This is a brand name, it should only be translated if the company does so -->
|
||||
<string name="menu_liberapay">Liberapay</string>
|
||||
<!-- This is a brand name, it should only be translated if the company does so -->
|
||||
<string name="menu_opencollective">OpenCollective</string>
|
||||
<!-- The bottom bar button label -->
|
||||
<string name="main_menu__latest_apps">Latest</string>
|
||||
<!-- The bottom bar button label -->
|
||||
|
@ -329,6 +329,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
"license",
|
||||
"litecoin",
|
||||
"name",
|
||||
"openCollective",
|
||||
"packageName",
|
||||
"phoneScreenshots",
|
||||
"promoGraphic",
|
||||
|
@ -49,6 +49,7 @@
|
||||
"issueTracker": "https://dev.guardianproject.info/projects/informacam/issues",
|
||||
"license": "GPLv3",
|
||||
"name": "CameraV",
|
||||
"openCollective": "GuardianProject",
|
||||
"sourceCode": "https://github.com/guardianproject/CameraV",
|
||||
"summary": "An InformaCam app to generate verifiable media",
|
||||
"webSite": "https://guardianproject.info/apps/camerav/",
|
||||
|
Loading…
x
Reference in New Issue
Block a user