mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03: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
|
* @param date
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isMonumentsEnabled(final Date date, final JsonKvStore store){
|
public static boolean isMonumentsEnabled(final Date date) {
|
||||||
if(date.getDay()>=1 && date.getMonth()>=9 && date.getDay()<=31 && date.getMonth()<=10 ){
|
if (date.getMonth() == 8) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
return store.getBoolean(CAMPAIGNS_DEFAULT_PREFERENCE) || true ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -241,7 +240,7 @@ public class Utils {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getWLMEndDate() {
|
public static String getWLMEndDate() {
|
||||||
return "31 Oct";
|
return "30 Sep";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,9 +117,8 @@ public class CampaignView extends SwipableCardView {
|
||||||
.parse(campaign.getStartDate());
|
.parse(campaign.getStartDate());
|
||||||
final Date endDate = CommonsDateUtil.getIso8601DateFormatShort()
|
final Date endDate = CommonsDateUtil.getIso8601DateFormatShort()
|
||||||
.parse(campaign.getEndDate());
|
.parse(campaign.getEndDate());
|
||||||
tvDates.setText(
|
tvDates.setText(String.format("%1s - %2s", DateUtil.getExtraShortDateString(startDate),
|
||||||
String.format("%1s - %2s", startDate,
|
DateUtil.getExtraShortDateString(endDate)));
|
||||||
endDate));
|
|
||||||
}
|
}
|
||||||
} catch (final ParseException e) {
|
} catch (final ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -528,7 +528,7 @@ public class ContributionsFragment
|
||||||
* of campaigns on the campaigns card
|
* of campaigns on the campaigns card
|
||||||
*/
|
*/
|
||||||
private void fetchCampaigns() {
|
private void fetchCampaigns() {
|
||||||
if (Utils.isMonumentsEnabled(new Date(), store)) {
|
if (Utils.isMonumentsEnabled(new Date())) {
|
||||||
campaignView.setCampaign(wlmCampaign);
|
campaignView.setCampaign(wlmCampaign);
|
||||||
campaignView.setVisibility(View.VISIBLE);
|
campaignView.setVisibility(View.VISIBLE);
|
||||||
} else if (store.getBoolean(CampaignView.CAMPAIGNS_DEFAULT_PREFERENCE, true)) {
|
} 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) {
|
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
isDarkTheme = systemThemeUtils.isDeviceInNightMode();
|
isDarkTheme = systemThemeUtils.isDeviceInNightMode();
|
||||||
if (Utils.isMonumentsEnabled(new Date(), applicationKvStore)) {
|
if (Utils.isMonumentsEnabled(new Date())) {
|
||||||
rlContainerWLMMonthMessage.setVisibility(View.VISIBLE);
|
rlContainerWLMMonthMessage.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
rlContainerWLMMonthMessage.setVisibility(View.GONE);
|
rlContainerWLMMonthMessage.setVisibility(View.GONE);
|
||||||
|
|
@ -513,7 +513,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
setBottomSheetCallbacks();
|
setBottomSheetCallbacks();
|
||||||
decideButtonVisibilities();
|
decideButtonVisibilities();
|
||||||
addActionToTitle();
|
addActionToTitle();
|
||||||
if(!Utils.isMonumentsEnabled(new Date(), applicationKvStore)){
|
if (!Utils.isMonumentsEnabled(new Date())) {
|
||||||
chipWlm.setVisibility(View.GONE);
|
chipWlm.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -884,7 +884,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
||||||
.fromCallable(() -> nearbyController
|
.fromCallable(() -> nearbyController
|
||||||
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
||||||
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
|
false, true, Utils.isMonumentsEnabled(new Date())));
|
||||||
|
|
||||||
compositeDisposable.add(nearbyPlacesInfoObservable
|
compositeDisposable.add(nearbyPlacesInfoObservable
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
|
@ -908,7 +908,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable
|
||||||
.fromCallable(() -> nearbyController
|
.fromCallable(() -> nearbyController
|
||||||
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
.loadAttractionsFromLocation(curlatLng, searchLatLng,
|
||||||
false, true, Utils.isMonumentsEnabled(new Date(), applicationKvStore)));
|
false, true, Utils.isMonumentsEnabled(new Date())));
|
||||||
|
|
||||||
compositeDisposable.add(nearbyPlacesInfoObservable
|
compositeDisposable.add(nearbyPlacesInfoObservable
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue