Skip to content

Commit 7476b0a

Browse files
ashishkumar468madhurgupta10misaochan
authored
Merge changes from 3.1-release (commons-app#4629)
* Cherry-Picked NPE fix from master (commons-app#4569) * Fix notification bug commons-app#4547 (commons-app#4570) * Make Single Query for Nearby and WLM pins (commons-app#4573) * Merge nearby and monument queries * Bug Fix- query resource path change on shouldQueryForMonuments * Bug Fixes 1. Propagate exceptions for nearby API calls to caller 2. Fix too much work on main thread exception in NearbyParentFragment * Modify parameters for Nearby query * Bug fix- current location marker (commons-app#4580) * Move WLM template below geolocation template (commons-app#4582) * Modify string for WLM upload notice * Fix bug commons-app#4583 (commons-app#4591) * Fix bug commons-app#4585 by updating kotlin and acra version (commons-app#4592) * Fixes commons-app#4554 - only use WLM2021 template for countries that are included in it (commons-app#4574) * Fixes commons-app#4554 1. For WLM uploads reverse geo code and see if the country code is supported -only then is the WLM upload flow triggered, otherwise usual nearby uploads happen 2. Bug Fix - Current Location marker and area * Fixed compile error added after rebasing * Bug fix for country code in reverse geo code * Update WLM camaign dates [Do not merge now, merge only after alpha release] (commons-app#4584) * Updates dates for WML campaign * Bug fix- campaign dates * Fixed logic for WLM enablement - stick to the month of September * Add countries supported by WLM2021 template, except Italy * Versioning for v3.1.0 * Update changelog.md * Fix empty default lang bug (commons-app#4608) * Fix bug commons-app#4583 * Fix empty default lang bug * Fixes commons-app#4595 - Updated nearby query (commons-app#4622) * Fixes commons-app#4595 - Updated nearby query * Removed logic to replace local language in nearby query - that might acccidentally replace other strings * Fetch property location in usual nearby query * Remove duplicate line (commons-app#4626) * Change "learn more" link to new wiki * Add Sweden's P3426 to property filter * Fixes commons-app#4601 - 1. Handle possible exceptions in upload file from stash 2. Modify MWException, as error is nullable, update getTitle and getMessage to rever that (commons-app#4627) * Versioning for v3.1.1 * Update changelog.md * Updated DB version to rever integrity Co-authored-by: Madhur Gupta <30932899+madhurgupta10@users.noreply.github.com> Co-authored-by: Josephine Lim <josephinelim86@gmail.com>
1 parent b912223 commit 7476b0a

38 files changed

+390
-416
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Wikimedia Commons for Android
22

3+
## v3.1.1
4+
- Optimized Nearby query
5+
- Added Sweden's property for WLM 2021
6+
- Added link to wiki explaining how to contribute to WLM through app
7+
- Fixed various bugs and crashes
8+
9+
## v3.1.0
10+
- Added Wiki Loves Monuments integration for WLM 2021
11+
312
## v3.0.2
413
- Fixed crash when uploading high res image
514
- Fixed crash when viewing images in Explore

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ dependencies {
5858
implementation "com.squareup.okhttp3:okhttp-ws:$OKHTTP_VERSION"
5959

6060
// Logging
61-
implementation 'ch.acra:acra-dialog:5.8.1-beta11'
62-
implementation 'ch.acra:acra-mail:5.8.1-beta11'
61+
implementation 'ch.acra:acra-dialog:5.8.4'
62+
implementation 'ch.acra:acra-mail:5.8.4'
6363
implementation 'org.slf4j:slf4j-api:1.7.25'
6464
api('com.github.tony19:logback-android-classic:1.1.1-6') {
6565
exclude group: 'com.google.android', module: 'android'
@@ -155,8 +155,8 @@ android {
155155
defaultConfig {
156156
//applicationId 'fr.free.nrw.commons'
157157

158-
versionCode 1021
159-
versionName '3.0.2'
158+
versionCode 1025
159+
versionName '3.1.1'
160160
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())
161161

162162
minSdkVersion 19
@@ -226,7 +226,7 @@ android {
226226
}
227227

228228
configurations.all {
229-
resolutionStrategy.force 'androidx.annotation:annotation:1.0.2'
229+
resolutionStrategy.force 'androidx.annotation:annotation:1.1.0'
230230
exclude module: 'okhttp-ws'
231231
}
232232
flavorDimensions 'tier'

app/src/main/java/fr/free/nrw/commons/Media.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ class Media constructor(
1212
* @return pageId for the current media object
1313
* Wikibase Identifier associated with media files
1414
*/
15-
val pageId: String = UUID.randomUUID().toString(),
16-
val thumbUrl: String? = null,
15+
var pageId: String = UUID.randomUUID().toString(),
16+
var thumbUrl: String? = null,
1717

1818
/**
1919
* Gets image URL
2020
* @return Image URL
2121
*/
22-
val imageUrl: String? = null,
22+
var imageUrl: String? = null,
2323
/**
2424
* Gets the name of the file.
2525
* @return file name as a string
2626
*/
27-
val filename: String? = null,
27+
var filename: String? = null,
2828
/**
2929
* Gets the file description.
3030
* @return file description as a string
@@ -41,7 +41,7 @@ class Media constructor(
4141
* Can be null.
4242
* @return upload date as a Date
4343
*/
44-
val dateUploaded: Date? = null,
44+
var dateUploaded: Date? = null,
4545
/**
4646
* Gets the license name of the file.
4747
* @return license as a String
@@ -52,7 +52,7 @@ class Media constructor(
5252
* @param license license name as a String
5353
*/
5454
var license: String? = null,
55-
val licenseUrl: String? = null,
55+
var licenseUrl: String? = null,
5656
/**
5757
* Gets the name of the creator of the file.
5858
* @return author name as a String
@@ -69,15 +69,15 @@ class Media constructor(
6969
* Gets the categories the file falls under.
7070
* @return file categories as an ArrayList of Strings
7171
*/
72-
val categories: List<String>? = null,
72+
var categories: List<String>? = null,
7373
/**
7474
* Gets the coordinates of where the file was created.
7575
* @return file coordinates as a LatLng
7676
*/
7777
var coordinates: LatLng? = null,
78-
val captions: Map<String, String> = emptyMap(),
79-
val descriptions: Map<String, String> = emptyMap(),
80-
val depictionIds: List<String> = emptyList()
78+
var captions: Map<String, String> = emptyMap(),
79+
var descriptions: Map<String, String> = emptyMap(),
80+
var depictionIds: List<String> = emptyList()
8181
) : Parcelable {
8282

8383
constructor(

app/src/main/java/fr/free/nrw/commons/Utils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,11 @@ public static void setUnderlinedText(TextView textView, int stringResourceName,
218218
* @param date
219219
* @return
220220
*/
221-
public static boolean isMonumentsEnabled(final Date date, final JsonKvStore store){
222-
if(date.getDay()>=1 && date.getMonth()>=9 && date.getDay()<=31 && date.getMonth()<=10 ){
221+
public static boolean isMonumentsEnabled(final Date date) {
222+
if (date.getMonth() == 8) {
223223
return true;
224224
}
225-
226-
return store.getBoolean(CAMPAIGNS_DEFAULT_PREFERENCE) || true ;
225+
return false;
227226
}
228227

229228
/**
@@ -241,7 +240,7 @@ public static String getWLMStartDate() {
241240
* @return
242241
*/
243242
public static String getWLMEndDate() {
244-
return "31 Oct";
243+
return "30 Sep";
245244
}
246245

247246
}

app/src/main/java/fr/free/nrw/commons/campaigns/CampaignView.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ public void init() {
117117
.parse(campaign.getStartDate());
118118
final Date endDate = CommonsDateUtil.getIso8601DateFormatShort()
119119
.parse(campaign.getEndDate());
120-
tvDates.setText(
121-
String.format("%1s - %2s", startDate,
122-
endDate));
120+
tvDates.setText(String.format("%1s - %2s", DateUtil.getExtraShortDateString(startDate),
121+
DateUtil.getExtraShortDateString(endDate)));
123122
}
124123
} catch (final ParseException e) {
125124
e.printStackTrace();

app/src/main/java/fr/free/nrw/commons/contributions/Contribution.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ data class Contribution constructor(
4040
var dateCreated: Date? = null,
4141
var dateModified: Date? = null,
4242
var hasInvalidLocation : Int = 0,
43-
var contentUri: Uri? = null
43+
var contentUri: Uri? = null,
44+
var countryCode : String? = null
4445
) : Parcelable {
4546

4647
fun completeWith(media: Media): Contribution {

app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ private void displayYouWontSeeNearbyMessage() {
454454
private void updateClosestNearbyCardViewInfo() {
455455
curLatLng = locationManager.getLastLocation();
456456
compositeDisposable.add(Observable.fromCallable(() -> nearbyController
457-
.loadAttractionsFromLocation(curLatLng, curLatLng, true, false)) // thanks to boolean, it will only return closest result
457+
.loadAttractionsFromLocation(curLatLng, curLatLng, true, false, false)) // thanks to boolean, it will only return closest result
458458
.subscribeOn(Schedulers.io())
459459
.observeOn(AndroidSchedulers.mainThread())
460460
.subscribe(this::updateNearbyNotification,
@@ -528,7 +528,7 @@ public void onLocationChangedMedium(LatLng latLng) {
528528
* of campaigns on the campaigns card
529529
*/
530530
private void fetchCampaigns() {
531-
if (Utils.isMonumentsEnabled(new Date(), store)) {
531+
if (Utils.isMonumentsEnabled(new Date())) {
532532
campaignView.setCampaign(wlmCampaign);
533533
campaignView.setVisibility(View.VISIBLE);
534534
} else if (store.getBoolean(CampaignView.CAMPAIGNS_DEFAULT_PREFERENCE, true)) {

app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public class DBOpenHelper extends SQLiteOpenHelper {
1414

1515
private static final String DATABASE_NAME = "commons.db";
16-
private static final int DATABASE_VERSION = 18;
16+
private static final int DATABASE_VERSION = 19;
1717
public static final String CONTRIBUTIONS_TABLE = "contributions";
1818
private final String DROP_TABLE_STATEMENT="DROP TABLE IF EXISTS %s";
1919

app/src/main/java/fr/free/nrw/commons/db/AppDatabase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import fr.free.nrw.commons.upload.depicts.DepictsDao
1414
* The database for accessing the respective DAOs
1515
*
1616
*/
17-
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class], version = 9, exportSchema = false)
17+
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class], version = 10, exportSchema = false)
1818
@TypeConverters(Converters::class)
1919
abstract class AppDatabase : RoomDatabase() {
2020
abstract fun contributionDao(): ContributionDao

app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ public void onResume() {
373373
media = getArguments().getParcelable("media");
374374
}
375375

376-
media = detailProvider.getMediaAtPosition(index);
377-
378376
if(media != null && applicationKvStore.getBoolean(String.format(NOMINATING_FOR_DELETION_MEDIA, media.getImageUrl()), false)) {
379377
enableProgressBar();
380378
}

0 commit comments

Comments
 (0)