Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions app/src/main/java/fr/free/nrw/commons/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@ public static int licenseNameFor(String license) {
return R.string.license_name_cc_by_sa_four;
case Prefs.Licenses.CC0:
return R.string.license_name_cc0;
case Prefs.Licenses.CC_BY: // for backward compatibility to v2.1
return R.string.license_name_cc_by_3_0;
case Prefs.Licenses.CC_BY_SA: // for backward compatibility to v2.1
return R.string.license_name_cc_by_sa_3_0;
}
throw new RuntimeException("Unrecognized license value: " + license);
throw new IllegalStateException("Unrecognized license value: " + license);
}

/**
Expand All @@ -132,7 +128,7 @@ public static String licenseUrlFor(String license) {
case Prefs.Licenses.CC0:
return "https://creativecommons.org/publicdomain/zero/1.0/";
default:
throw new RuntimeException("Unrecognized license value: " + license);
throw new IllegalStateException("Unrecognized license value: " + license);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,6 @@ private String licenseTemplateFor(String license) {
return "{{self|cc-by-sa-4.0}}";
case Prefs.Licenses.CC0:
return "{{self|cc-zero}}";
case Prefs.Licenses.CC_BY:
return "{{self|cc-by-3.0}}";
case Prefs.Licenses.CC_BY_SA:
return "{{self|cc-by-sa-3.0}}";
}

throw new RuntimeException("Unrecognized license value: " + license);
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/fr/free/nrw/commons/settings/Prefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@ public static class Licenses {
public static final String CC_BY_SA_4 = "CC BY-SA 4.0";
public static final String CC_BY_4 = "CC BY 4.0";
public static final String CC0 = "CC0";

// kept for backward compatibility to v2.1
@Deprecated public static final String CC_BY = "CC BY";
@Deprecated public static final String CC_BY_SA = "CC BY-SA";
}
}
26 changes: 16 additions & 10 deletions app/src/main/java/fr/free/nrw/commons/upload/UploadPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

import android.annotation.SuppressLint;
import android.content.Context;

import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.category.CategoriesModel;
import fr.free.nrw.commons.contributions.Contribution;
import fr.free.nrw.commons.filepicker.UploadableFile;
Expand All @@ -23,6 +15,12 @@
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import timber.log.Timber;

import static fr.free.nrw.commons.upload.UploadModel.UploadItem;
Expand Down Expand Up @@ -330,7 +328,15 @@ private void updateCards() {
* Sets the list of licences and the default license.
*/
private void updateLicenses() {
String selectedLicense = defaultKvStore.getString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_3);
String selectedLicense = defaultKvStore.getString(Prefs.DEFAULT_LICENSE,
Prefs.Licenses.CC_BY_SA_4);//CC_BY_SA_4 is the default one used by the commons web app
try {//I have to make sure that the stored default license was not one of the deprecated one's
Utils.licenseNameFor(selectedLicense);
} catch (IllegalStateException exception) {
Timber.e(exception.getMessage());
selectedLicense = Prefs.Licenses.CC_BY_SA_4;
defaultKvStore.putString(Prefs.DEFAULT_LICENSE, Prefs.Licenses.CC_BY_SA_4);
}
view.updateLicenses(uploadModel.getLicenses(), selectedLicense);
view.updateLicenseSummary(selectedLicense, uploadModel.getCount());
}
Expand Down