From 611fd6e5e3c6cf8df179c1682e64cb5c500bc6e9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 25 Nov 2016 23:36:37 +0100 Subject: [PATCH] rename App instance vars to match fdroidserver field names This makes the name of the instance variables in the App class match the names of the metadata fields in the new fdroidserver .yml YAML format. This means that the Jackson parser can automatically instantiate instances for us, which will be more efficient and maintainable. These names aren't great, but it would a ton of work to rename the field names in all of the metadata files, the docs, fdroidserver code, etc. --- .../java/org/fdroid/fdroid/AppDetails.java | 32 ++--- .../org/fdroid/fdroid/RepoXMLHandler.java | 18 +-- .../main/java/org/fdroid/fdroid/data/App.java | 112 +++++++++--------- .../java/org/fdroid/fdroid/data/DBHelper.java | 36 +++--- .../java/org/fdroid/fdroid/data/Schema.java | 26 ++-- .../views/AppDetailsRecyclerViewAdapter.java | 32 ++--- .../updater/ProperMultiRepoUpdaterTest.java | 28 ++--- 7 files changed, 142 insertions(+), 142 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/AppDetails.java b/app/src/main/java/org/fdroid/fdroid/AppDetails.java index 0452e6e3e..8ff6ee17b 100644 --- a/app/src/main/java/org/fdroid/fdroid/AppDetails.java +++ b/app/src/main/java/org/fdroid/fdroid/AppDetails.java @@ -1163,23 +1163,23 @@ public class AppDetails extends AppCompatActivity { App app = appDetails.getApp(); switch (v.getId()) { case R.id.website: - url = app.webURL; + url = app.webSite; break; case R.id.email: final String subject = Uri.encode(getString(R.string.app_details_subject, app.name)); - url = "mailto:" + app.email + "?subject=" + subject; + url = "mailto:" + app.authorEmail + "?subject=" + subject; break; case R.id.source: - url = app.sourceURL; + url = app.sourceCode; break; case R.id.issues: - url = app.trackerURL; + url = app.issueTracker; break; case R.id.changelog: - url = app.changelogURL; + url = app.changelog; break; case R.id.donate: - url = app.donateURL; + url = app.donate; break; case R.id.bitcoin: url = app.getBitcoinUri(); @@ -1267,7 +1267,7 @@ public class AppDetails extends AppCompatActivity { // Website button View tv = view.findViewById(R.id.website); - if (!TextUtils.isEmpty(app.webURL)) { + if (!TextUtils.isEmpty(app.webSite)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1275,7 +1275,7 @@ public class AppDetails extends AppCompatActivity { // Email button tv = view.findViewById(R.id.email); - if (!TextUtils.isEmpty(app.email)) { + if (!TextUtils.isEmpty(app.authorEmail)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1283,7 +1283,7 @@ public class AppDetails extends AppCompatActivity { // Source button tv = view.findViewById(R.id.source); - if (!TextUtils.isEmpty(app.sourceURL)) { + if (!TextUtils.isEmpty(app.sourceCode)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1291,7 +1291,7 @@ public class AppDetails extends AppCompatActivity { // Issues button tv = view.findViewById(R.id.issues); - if (!TextUtils.isEmpty(app.trackerURL)) { + if (!TextUtils.isEmpty(app.issueTracker)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1299,7 +1299,7 @@ public class AppDetails extends AppCompatActivity { // Changelog button tv = view.findViewById(R.id.changelog); - if (!TextUtils.isEmpty(app.changelogURL)) { + if (!TextUtils.isEmpty(app.changelog)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1307,7 +1307,7 @@ public class AppDetails extends AppCompatActivity { // Donate button tv = view.findViewById(R.id.donate); - if (!TextUtils.isEmpty(app.donateURL)) { + if (!TextUtils.isEmpty(app.donate)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1315,7 +1315,7 @@ public class AppDetails extends AppCompatActivity { // Bitcoin tv = view.findViewById(R.id.bitcoin); - if (!TextUtils.isEmpty(app.bitcoinAddr)) { + if (!TextUtils.isEmpty(app.bitcoin)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1323,7 +1323,7 @@ public class AppDetails extends AppCompatActivity { // Litecoin tv = view.findViewById(R.id.litecoin); - if (!TextUtils.isEmpty(app.litecoinAddr)) { + if (!TextUtils.isEmpty(app.litecoin)) { tv.setOnClickListener(onClickListener); } else { tv.setVisibility(View.GONE); @@ -1642,8 +1642,8 @@ public class AppDetails extends AppCompatActivity { btMain.setEnabled(true); } TextView author = (TextView) view.findViewById(R.id.author); - if (!TextUtils.isEmpty(app.author)) { - author.setText(getString(R.string.by_author) + " " + app.author); + if (!TextUtils.isEmpty(app.authorName)) { + author.setText(getString(R.string.by_author) + " " + app.authorName); author.setVisibility(View.VISIBLE); } TextView currentVersion = (TextView) view.findViewById(R.id.current_version); diff --git a/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java b/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java index 09a883591..e822348c7 100644 --- a/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java +++ b/app/src/main/java/org/fdroid/fdroid/RepoXMLHandler.java @@ -205,34 +205,34 @@ public class RepoXMLHandler extends DefaultHandler { curapp.license = str; break; case "author": - curapp.author = str; + curapp.authorName = str; break; case "email": - curapp.email = str; + curapp.authorEmail = str; break; case "source": - curapp.sourceURL = str; + curapp.sourceCode = str; break; case "changelog": - curapp.changelogURL = str; + curapp.changelog = str; break; case "donate": - curapp.donateURL = str; + curapp.donate = str; break; case "bitcoin": - curapp.bitcoinAddr = str; + curapp.bitcoin = str; break; case "litecoin": - curapp.litecoinAddr = str; + curapp.litecoin = str; break; case "flattr": curapp.flattrID = str; break; case "web": - curapp.webURL = str; + curapp.webSite = str; break; case "tracker": - curapp.trackerURL = str; + curapp.issueTracker = str; break; case "added": curapp.added = Utils.parseDate(str, null); diff --git a/app/src/main/java/org/fdroid/fdroid/data/App.java b/app/src/main/java/org/fdroid/fdroid/data/App.java index 485e87351..e301bd74c 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/App.java +++ b/app/src/main/java/org/fdroid/fdroid/data/App.java @@ -65,22 +65,22 @@ public class App extends ValueObject implements Comparable, Parcelable { public String license = "Unknown"; - public String author; - public String email; + public String authorName; + public String authorEmail; - public String webURL; + public String webSite; - public String trackerURL; + public String issueTracker; - public String sourceURL; + public String sourceCode; - public String changelogURL; + public String changelog; - public String donateURL; + public String donate; - public String bitcoinAddr; + public String bitcoin; - public String litecoinAddr; + public String litecoin; public String flattrID; @@ -186,32 +186,32 @@ public class App extends ValueObject implements Comparable, Parcelable { case Cols.LICENSE: license = cursor.getString(i); break; - case Cols.AUTHOR: - author = cursor.getString(i); + case Cols.AUTHOR_NAME: + authorName = cursor.getString(i); break; - case Cols.EMAIL: - email = cursor.getString(i); + case Cols.AUTHOR_EMAIL: + authorEmail = cursor.getString(i); break; - case Cols.WEB_URL: - webURL = cursor.getString(i); + case Cols.WEBSITE: + webSite = cursor.getString(i); break; - case Cols.TRACKER_URL: - trackerURL = cursor.getString(i); + case Cols.ISSUE_TRACKER: + issueTracker = cursor.getString(i); break; - case Cols.SOURCE_URL: - sourceURL = cursor.getString(i); + case Cols.SOURCE_CODE: + sourceCode = cursor.getString(i); break; - case Cols.CHANGELOG_URL: - changelogURL = cursor.getString(i); + case Cols.CHANGELOG: + changelog = cursor.getString(i); break; - case Cols.DONATE_URL: - donateURL = cursor.getString(i); + case Cols.DONATE: + donate = cursor.getString(i); break; - case Cols.BITCOIN_ADDR: - bitcoinAddr = cursor.getString(i); + case Cols.BITCOIN: + bitcoin = cursor.getString(i); break; - case Cols.LITECOIN_ADDR: - litecoinAddr = cursor.getString(i); + case Cols.LITECOIN: + litecoin = cursor.getString(i); break; case Cols.FLATTR_ID: flattrID = cursor.getString(i); @@ -490,15 +490,15 @@ public class App extends ValueObject implements Comparable, Parcelable { values.put(Cols.ICON_URL_LARGE, iconUrlLarge); values.put(Cols.DESCRIPTION, description); values.put(Cols.LICENSE, license); - values.put(Cols.AUTHOR, author); - values.put(Cols.EMAIL, email); - values.put(Cols.WEB_URL, webURL); - values.put(Cols.TRACKER_URL, trackerURL); - values.put(Cols.SOURCE_URL, sourceURL); - values.put(Cols.CHANGELOG_URL, changelogURL); - values.put(Cols.DONATE_URL, donateURL); - values.put(Cols.BITCOIN_ADDR, bitcoinAddr); - values.put(Cols.LITECOIN_ADDR, litecoinAddr); + values.put(Cols.AUTHOR_NAME, authorName); + values.put(Cols.AUTHOR_EMAIL, authorEmail); + values.put(Cols.WEBSITE, webSite); + values.put(Cols.ISSUE_TRACKER, issueTracker); + values.put(Cols.SOURCE_CODE, sourceCode); + values.put(Cols.CHANGELOG, changelog); + values.put(Cols.DONATE, donate); + values.put(Cols.BITCOIN, bitcoin); + values.put(Cols.LITECOIN, litecoin); values.put(Cols.FLATTR_ID, flattrID); values.put(Cols.ADDED, Utils.formatDate(added, "")); values.put(Cols.LAST_UPDATED, Utils.formatDate(lastUpdated, "")); @@ -556,12 +556,12 @@ public class App extends ValueObject implements Comparable, Parcelable { @Nullable public String getBitcoinUri() { - return TextUtils.isEmpty(bitcoinAddr) ? null : "bitcoin:" + bitcoinAddr; + return TextUtils.isEmpty(bitcoin) ? null : "bitcoin:" + bitcoin; } @Nullable public String getLitecoinUri() { - return TextUtils.isEmpty(litecoinAddr) ? null : "litecoin:" + litecoinAddr; + return TextUtils.isEmpty(bitcoin) ? null : "litecoin:" + bitcoin; } @Nullable @@ -632,15 +632,15 @@ public class App extends ValueObject implements Comparable, Parcelable { dest.writeString(this.icon); dest.writeString(this.description); dest.writeString(this.license); - dest.writeString(this.author); - dest.writeString(this.email); - dest.writeString(this.webURL); - dest.writeString(this.trackerURL); - dest.writeString(this.sourceURL); - dest.writeString(this.changelogURL); - dest.writeString(this.donateURL); - dest.writeString(this.bitcoinAddr); - dest.writeString(this.litecoinAddr); + dest.writeString(this.authorName); + dest.writeString(this.authorEmail); + dest.writeString(this.webSite); + dest.writeString(this.issueTracker); + dest.writeString(this.sourceCode); + dest.writeString(this.changelog); + dest.writeString(this.donate); + dest.writeString(this.bitcoin); + dest.writeString(this.litecoin); dest.writeString(this.flattrID); dest.writeString(this.upstreamVersionName); dest.writeInt(this.upstreamVersionCode); @@ -669,15 +669,15 @@ public class App extends ValueObject implements Comparable, Parcelable { this.icon = in.readString(); this.description = in.readString(); this.license = in.readString(); - this.author = in.readString(); - this.email = in.readString(); - this.webURL = in.readString(); - this.trackerURL = in.readString(); - this.sourceURL = in.readString(); - this.changelogURL = in.readString(); - this.donateURL = in.readString(); - this.bitcoinAddr = in.readString(); - this.litecoinAddr = in.readString(); + this.authorName = in.readString(); + this.authorEmail = in.readString(); + this.webSite = in.readString(); + this.issueTracker = in.readString(); + this.sourceCode = in.readString(); + this.changelog = in.readString(); + this.donate = in.readString(); + this.bitcoin = in.readString(); + this.litecoin = in.readString(); this.flattrID = in.readString(); this.upstreamVersionName = in.readString(); this.upstreamVersionCode = in.readInt(); diff --git a/app/src/main/java/org/fdroid/fdroid/data/DBHelper.java b/app/src/main/java/org/fdroid/fdroid/data/DBHelper.java index 4803e78b3..14c10abb5 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/DBHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/data/DBHelper.java @@ -116,19 +116,19 @@ class DBHelper extends SQLiteOpenHelper { + AppMetadataTable.Cols.ICON + " text, " + AppMetadataTable.Cols.DESCRIPTION + " text not null, " + AppMetadataTable.Cols.LICENSE + " text not null, " - + AppMetadataTable.Cols.AUTHOR + " text, " - + AppMetadataTable.Cols.EMAIL + " text, " - + AppMetadataTable.Cols.WEB_URL + " text, " - + AppMetadataTable.Cols.TRACKER_URL + " text, " - + AppMetadataTable.Cols.SOURCE_URL + " text, " - + AppMetadataTable.Cols.CHANGELOG_URL + " text, " + + AppMetadataTable.Cols.AUTHOR_NAME + " text, " + + AppMetadataTable.Cols.AUTHOR_EMAIL + " text, " + + AppMetadataTable.Cols.WEBSITE + " text, " + + AppMetadataTable.Cols.ISSUE_TRACKER + " text, " + + AppMetadataTable.Cols.SOURCE_CODE + " text, " + + AppMetadataTable.Cols.CHANGELOG + " text, " + AppMetadataTable.Cols.SUGGESTED_VERSION_CODE + " text," + AppMetadataTable.Cols.UPSTREAM_VERSION_NAME + " text," + AppMetadataTable.Cols.UPSTREAM_VERSION_CODE + " integer," + AppMetadataTable.Cols.ANTI_FEATURES + " string," - + AppMetadataTable.Cols.DONATE_URL + " string," - + AppMetadataTable.Cols.BITCOIN_ADDR + " string," - + AppMetadataTable.Cols.LITECOIN_ADDR + " string," + + AppMetadataTable.Cols.DONATE + " string," + + AppMetadataTable.Cols.BITCOIN + " string," + + AppMetadataTable.Cols.LITECOIN + " string," + AppMetadataTable.Cols.FLATTR_ID + " string," + AppMetadataTable.Cols.REQUIREMENTS + " string," + AppMetadataTable.Cols.ADDED + " string," @@ -756,11 +756,11 @@ class DBHelper extends SQLiteOpenHelper { } private void addChangelogToApp(SQLiteDatabase db, int oldVersion) { - if (oldVersion >= 48 || columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.CHANGELOG_URL)) { + if (oldVersion >= 48 || columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.CHANGELOG)) { return; } - Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.CHANGELOG_URL + " column to " + AppMetadataTable.NAME); - db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.CHANGELOG_URL + " text"); + Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.CHANGELOG + " column to " + AppMetadataTable.NAME); + db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.CHANGELOG + " text"); } private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) { @@ -809,13 +809,13 @@ class DBHelper extends SQLiteOpenHelper { if (oldVersion >= 53) { return; } - if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR)) { - Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR + " column to " + AppMetadataTable.NAME); - db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR + " text"); + if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR_NAME)) { + Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR_NAME + " column to " + AppMetadataTable.NAME); + db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR_NAME + " text"); } - if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.EMAIL)) { - Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.EMAIL + " column to " + AppMetadataTable.NAME); - db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.EMAIL + " text"); + if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR_EMAIL)) { + Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR_EMAIL + " column to " + AppMetadataTable.NAME); + db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR_EMAIL + " text"); } } diff --git a/app/src/main/java/org/fdroid/fdroid/data/Schema.java b/app/src/main/java/org/fdroid/fdroid/data/Schema.java index 9d1a7a439..54c44c407 100644 --- a/app/src/main/java/org/fdroid/fdroid/data/Schema.java +++ b/app/src/main/java/org/fdroid/fdroid/data/Schema.java @@ -124,15 +124,15 @@ public interface Schema { String ICON = "icon"; String DESCRIPTION = "description"; String LICENSE = "license"; - String AUTHOR = "author"; - String EMAIL = "email"; - String WEB_URL = "webURL"; - String TRACKER_URL = "trackerURL"; - String SOURCE_URL = "sourceURL"; - String CHANGELOG_URL = "changelogURL"; - String DONATE_URL = "donateURL"; - String BITCOIN_ADDR = "bitcoinAddr"; - String LITECOIN_ADDR = "litecoinAddr"; + String AUTHOR_NAME = "author"; + String AUTHOR_EMAIL = "email"; + String WEBSITE = "webURL"; + String ISSUE_TRACKER = "trackerURL"; + String SOURCE_CODE = "sourceURL"; + String CHANGELOG = "changelogURL"; + String DONATE = "donateURL"; + String BITCOIN = "bitcoinAddr"; + String LITECOIN = "litecoinAddr"; String FLATTR_ID = "flattrID"; String SUGGESTED_VERSION_CODE = "suggestedVercode"; String UPSTREAM_VERSION_NAME = "upstreamVersion"; @@ -176,8 +176,8 @@ public interface Schema { */ String[] ALL_COLS = { ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION, - LICENSE, AUTHOR, EMAIL, WEB_URL, TRACKER_URL, SOURCE_URL, - CHANGELOG_URL, DONATE_URL, BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID, + LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE, + CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE, SUGGESTED_VERSION_CODE, @@ -190,8 +190,8 @@ public interface Schema { */ String[] ALL = { _ID, ROW_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION, - LICENSE, AUTHOR, EMAIL, WEB_URL, TRACKER_URL, SOURCE_URL, - CHANGELOG_URL, DONATE_URL, BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID, + LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE, + CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE, SUGGESTED_VERSION_CODE, SuggestedApk.VERSION_NAME, diff --git a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java index e8ac029af..071f85bd9 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java +++ b/app/src/main/java/org/fdroid/fdroid/views/AppDetailsRecyclerViewAdapter.java @@ -176,7 +176,7 @@ public class AppDetailsRecyclerViewAdapter } private boolean shouldShowDonate() { - return uriIsSetAndCanBeOpened(app.donateURL) || + return uriIsSetAndCanBeOpened(app.donate) || uriIsSetAndCanBeOpened(app.getBitcoinUri()) || uriIsSetAndCanBeOpened(app.getLitecoinUri()) || uriIsSetAndCanBeOpened(app.getFlattrUri()); @@ -382,8 +382,8 @@ public class AppDetailsRecyclerViewAdapter public void bindModel() { ImageLoader.getInstance().displayImage(app.iconUrlLarge, iconView, displayImageOptions); titleView.setText(app.name); - if (!TextUtils.isEmpty(app.author)) { - authorView.setText(context.getString(R.string.by_author) + " " + app.author); + if (!TextUtils.isEmpty(app.authorName)) { + authorView.setText(context.getString(R.string.by_author) + " " + app.authorName); authorView.setVisibility(View.VISIBLE); } else { authorView.setVisibility(View.GONE); @@ -523,18 +523,18 @@ public class AppDetailsRecyclerViewAdapter } public void bindModel() { - if (TextUtils.isEmpty(app.author)) { + if (TextUtils.isEmpty(app.authorName)) { donateHeading.setText(context.getString(R.string.app_details_donate_prompt_unknown_author, app.name)); } else { - String author = "" + app.author + ""; + String author = "" + app.authorName + ""; donateHeading.setText(Html.fromHtml(context.getString(R.string.app_details_donate_prompt, app.name, author))); } donationOptionsLayout.removeAllViews(); // Donate button - if (uriIsSetAndCanBeOpened(app.donateURL)) { - addDonateOption(R.layout.donate_generic, app.donateURL); + if (uriIsSetAndCanBeOpened(app.donate)) { + addDonateOption(R.layout.donate_generic, app.donate); } // Bitcoin @@ -639,28 +639,28 @@ public class AppDetailsRecyclerViewAdapter contentView.removeAllViews(); // Source button - if (uriIsSetAndCanBeOpened(app.sourceURL)) { - addLinkItemView(contentView, R.string.menu_source, R.drawable.ic_source_code, app.sourceURL); + if (uriIsSetAndCanBeOpened(app.sourceCode)) { + addLinkItemView(contentView, R.string.menu_source, R.drawable.ic_source_code, app.sourceCode); } // Issues button - if (uriIsSetAndCanBeOpened(app.trackerURL)) { - addLinkItemView(contentView, R.string.menu_issues, R.drawable.ic_issues, app.trackerURL); + if (uriIsSetAndCanBeOpened(app.issueTracker)) { + addLinkItemView(contentView, R.string.menu_issues, R.drawable.ic_issues, app.issueTracker); } // Changelog button - if (uriIsSetAndCanBeOpened(app.changelogURL)) { - addLinkItemView(contentView, R.string.menu_changelog, R.drawable.ic_changelog, app.changelogURL); + if (uriIsSetAndCanBeOpened(app.changelog)) { + addLinkItemView(contentView, R.string.menu_changelog, R.drawable.ic_changelog, app.changelog); } // Website button - if (uriIsSetAndCanBeOpened(app.webURL)) { - addLinkItemView(contentView, R.string.menu_website, R.drawable.ic_website, app.webURL); + if (uriIsSetAndCanBeOpened(app.webSite)) { + addLinkItemView(contentView, R.string.menu_website, R.drawable.ic_website, app.webSite); } // Email button final String subject = Uri.encode(context.getString(R.string.app_details_subject, app.name)); - String emailUrl = app.email == null ? null : ("mailto:" + app.email + "?subject=" + subject); + String emailUrl = app.authorEmail == null ? null : ("mailto:" + app.authorEmail + "?subject=" + subject); if (uriIsSetAndCanBeOpened(emailUrl)) { addLinkItemView(contentView, R.string.menu_email, R.drawable.ic_email, emailUrl); } diff --git a/app/src/test/java/org/fdroid/fdroid/updater/ProperMultiRepoUpdaterTest.java b/app/src/test/java/org/fdroid/fdroid/updater/ProperMultiRepoUpdaterTest.java index 19dea49bb..e978ec5ac 100644 --- a/app/src/test/java/org/fdroid/fdroid/updater/ProperMultiRepoUpdaterTest.java +++ b/app/src/test/java/org/fdroid/fdroid/updater/ProperMultiRepoUpdaterTest.java @@ -274,9 +274,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest { assertEquals("2048", a2048.name); assertEquals(String.format("

2048 from %s repo.

", id), a2048.description); assertEquals(String.format("Puzzle game (%s)", id), a2048.summary); - assertEquals(String.format("https://github.com/uberspot/2048-android?%s", id), a2048.webURL); - assertEquals(String.format("https://github.com/uberspot/2048-android?code&%s", id), a2048.sourceURL); - assertEquals(String.format("https://github.com/uberspot/2048-android/issues?%s", id), a2048.trackerURL); + assertEquals(String.format("https://github.com/uberspot/2048-android?%s", id), a2048.webSite); + assertEquals(String.format("https://github.com/uberspot/2048-android?code&%s", id), a2048.sourceCode); + assertEquals(String.format("https://github.com/uberspot/2048-android/issues?%s", id), a2048.issueTracker); } private void assertAdAwayMetadata(Repo repo, @RepoIdentifier String id) { @@ -290,11 +290,11 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest { assertEquals(String.format("AdAway", id), adaway.name); assertEquals(String.format("

AdAway from %s repo.

", id), adaway.description); assertEquals(String.format("Block advertisements (%s)", id), adaway.summary); - assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.webURL); - assertEquals(String.format("https://github.com/dschuermann/ad-away?%s", id), adaway.sourceURL); - assertEquals(String.format("https://github.com/dschuermann/ad-away/issues?%s", id), adaway.trackerURL); - assertEquals(String.format("https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG?%s", id), adaway.changelogURL); - assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.donateURL); + assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.webSite); + assertEquals(String.format("https://github.com/dschuermann/ad-away?%s", id), adaway.sourceCode); + assertEquals(String.format("https://github.com/dschuermann/ad-away/issues?%s", id), adaway.issueTracker); + assertEquals(String.format("https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG?%s", id), adaway.changelog); + assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.donate); assertEquals(String.format("369138", id), adaway.flattrID); } @@ -309,9 +309,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest { assertEquals("adbWireless", adb.name); assertEquals(String.format("

adbWireless from %s repo.

", id), adb.description); assertEquals(String.format("Wireless adb (%s)", id), adb.summary); - assertEquals(String.format("https://adbwireless.example.com?%s", id), adb.webURL); - assertEquals(String.format("https://adbwireless.example.com/source?%s", id), adb.sourceURL); - assertEquals(String.format("https://adbwireless.example.com/issues?%s", id), adb.trackerURL); + assertEquals(String.format("https://adbwireless.example.com?%s", id), adb.webSite); + assertEquals(String.format("https://adbwireless.example.com/source?%s", id), adb.sourceCode); + assertEquals(String.format("https://adbwireless.example.com/issues?%s", id), adb.issueTracker); } private void assertCalendarMetadata(Repo repo, @RepoIdentifier String id) { @@ -325,9 +325,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest { assertEquals("Add to calendar", calendar.name); assertEquals(String.format("

Add to calendar from %s repo.

", id), calendar.description); assertEquals(String.format("Import .ics files into calendar (%s)", id), calendar.summary); - assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/blob/HEAD/README.md?%s", id), calendar.webURL); - assertEquals(String.format("https://github.com/danielegobbetti/ICSImport?%s", id), calendar.sourceURL); - assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/issues?%s", id), calendar.trackerURL); + assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/blob/HEAD/README.md?%s", id), calendar.webSite); + assertEquals(String.format("https://github.com/danielegobbetti/ICSImport?%s", id), calendar.sourceCode); + assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/issues?%s", id), calendar.issueTracker); assertEquals("2225390", calendar.flattrID); }