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
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ public View onCreateView(@NonNull LayoutInflater inflater,
ivEventPoster.setVisibility(View.GONE);
}

Integer maxWaitlist = event.getMaxWaitlistSize();
Integer currentWaitlistCount = event.countEntries(); // how many are currently on waitlist

boolean waitlistFull = maxWaitlist != null
&& currentWaitlistCount != null
&& currentWaitlistCount >= maxWaitlist;

if (waitlistFull) {
buttonJoinWaitlist.setEnabled(false);
buttonJoinWaitlist.setText("Waitlist Full");
}

// Enable only if registration deadline is in the future (or not set)
Date deadline = event.getRegistrationCloses();
boolean canJoin = (deadline == null) || deadline.after(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ public void joinWaitlist(Context context) {
return;
}

Integer maxWaitlist = e.getMaxWaitlistSize();
Integer current = waitlistCount.getValue();

if (maxWaitlist != null && current != null && current >= maxWaitlist) {
message.setValue("Waitlist is full");
return;
}

String uid = AuthManager.getInstance().getUserId();

if (uid == null) {
Expand All @@ -163,6 +171,13 @@ public void joinWaitlist(Context context) {

LocationService locationService = LocationService.create(context);

if (uid == null) {
message.setValue("Please sign in first");
return;
}

loading.setValue(true);

locationService.getCurrentLocation(new LocationService.LocationCallback() {
@Override
public void onLocationResult(Location location) {
Expand Down