Skip to content

Commit 74e8472

Browse files
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
1 parent 7deaf8d commit 74e8472

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

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/ContributionsFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/nearby/fragments/NearbyParentFragment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public boolean onMenuItemClick(MenuItem item) {
284284
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
285285
super.onViewCreated(view, savedInstanceState);
286286
isDarkTheme = systemThemeUtils.isDeviceInNightMode();
287-
if (Utils.isMonumentsEnabled(new Date(), applicationKvStore)) {
287+
if (Utils.isMonumentsEnabled(new Date())) {
288288
rlContainerWLMMonthMessage.setVisibility(View.VISIBLE);
289289
} else {
290290
rlContainerWLMMonthMessage.setVisibility(View.GONE);
@@ -513,7 +513,7 @@ private void initViews() {
513513
setBottomSheetCallbacks();
514514
decideButtonVisibilities();
515515
addActionToTitle();
516-
if(!Utils.isMonumentsEnabled(new Date(), applicationKvStore)){
516+
if (!Utils.isMonumentsEnabled(new Date())) {
517517
chipWlm.setVisibility(View.GONE);
518518
}
519519
}
@@ -884,7 +884,7 @@ private void populatePlacesForCurrentLocation(final fr.free.nrw.commons.location
884884
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
885885
.fromCallable(() -> nearbyController
886886
.loadAttractionsFromLocation(curlatLng, searchLatLng,
887-
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
887+
false, true, Utils.isMonumentsEnabled(new Date())));
888888

889889
compositeDisposable.add(nearbyPlacesInfoObservable
890890
.subscribeOn(Schedulers.io())
@@ -908,7 +908,7 @@ private void populatePlacesForAnotherLocation(final fr.free.nrw.commons.location
908908
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
909909
.fromCallable(() -> nearbyController
910910
.loadAttractionsFromLocation(curlatLng, searchLatLng,
911-
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
911+
false, true, Utils.isMonumentsEnabled(new Date())));
912912

913913
compositeDisposable.add(nearbyPlacesInfoObservable
914914
.subscribeOn(Schedulers.io())

0 commit comments

Comments
 (0)