mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Update WLM camaign dates [Do not merge now, merge only after alpha release] (#4584)
* Updates dates for WML campaign * Bug fix- campaign dates * Fixed logic for WLM enablement - stick to the month of September
This commit is contained in:
parent
7deaf8dbae
commit
74e8472d91
4 changed files with 11 additions and 13 deletions
|
|
@ -218,12 +218,11 @@ public class Utils {
|
|||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMonumentsEnabled(final Date date, final JsonKvStore store){
|
||||
if(date.getDay()>=1 && date.getMonth()>=9 && date.getDay()<=31 && date.getMonth()<=10 ){
|
||||
public static boolean isMonumentsEnabled(final Date date) {
|
||||
if (date.getMonth() == 8) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return store.getBoolean(CAMPAIGNS_DEFAULT_PREFERENCE) || true ;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -241,7 +240,7 @@ public class Utils {
|
|||
* @return
|
||||
*/
|
||||
public static String getWLMEndDate() {
|
||||
return "31 Oct";
|
||||
return "30 Sep";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,9 +117,8 @@ public class CampaignView extends SwipableCardView {
|
|||
.parse(campaign.getStartDate());
|
||||
final Date endDate = CommonsDateUtil.getIso8601DateFormatShort()
|
||||
.parse(campaign.getEndDate());
|
||||
tvDates.setText(
|
||||
String.format("%1s - %2s", startDate,
|
||||
endDate));
|
||||
tvDates.setText(String.format("%1s - %2s", DateUtil.getExtraShortDateString(startDate),
|
||||
DateUtil.getExtraShortDateString(endDate)));
|
||||
}
|
||||
} catch (final ParseException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ public class ContributionsFragment
|
|||
* of campaigns on the campaigns card
|
||||
*/
|
||||
private void fetchCampaigns() {
|
||||
if (Utils.isMonumentsEnabled(new Date(), store)) {
|
||||
if (Utils.isMonumentsEnabled(new Date())) {
|
||||
campaignView.setCampaign(wlmCampaign);
|
||||
campaignView.setVisibility(View.VISIBLE);
|
||||
} else if (store.getBoolean(CampaignView.CAMPAIGNS_DEFAULT_PREFERENCE, true)) {
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
isDarkTheme = systemThemeUtils.isDeviceInNightMode();
|
||||
if (Utils.isMonumentsEnabled(new Date(), applicationKvStore)) {
|
||||
if (Utils.isMonumentsEnabled(new Date())) {
|
||||
rlContainerWLMMonthMessage.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
rlContainerWLMMonthMessage.setVisibility(View.GONE);
|
||||
|
|
@ -513,7 +513,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
setBottomSheetCallbacks();
|
||||
decideButtonVisibilities();
|
||||
addActionToTitle();
|
||||
if(!Utils.isMonumentsEnabled(new Date(), applicationKvStore)){
|
||||
if (!Utils.isMonumentsEnabled(new Date())) {
|
||||
chipWlm.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
|
@ -884,7 +884,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
||||
.fromCallable(() -> nearbyController
|
||||
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
||||
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
|
||||
false, true, Utils.isMonumentsEnabled(new Date())));
|
||||
|
||||
compositeDisposable.add(nearbyPlacesInfoObservable
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
|
@ -908,7 +908,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
||||
.fromCallable(() -> nearbyController
|
||||
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
||||
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
|
||||
false, true, Utils.isMonumentsEnabled(new Date())));
|
||||
|
||||
compositeDisposable.add(nearbyPlacesInfoObservable
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue