Skip to content

Commit 7726e9d

Browse files
committed
Fixes fossasia#2318 Events bookmarked from Featured Speakers are now visible in AboutFragment.
1 parent 4c5db53 commit 7726e9d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

android/app/src/main/java/org/fossasia/openevent/core/about/AboutFragmentViewModel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class AboutFragmentViewModel extends ViewModel {
3434
private LiveData<Event> eventLiveData;
3535
private LiveData<List<Speaker>> featuredSpeakers;
3636
private MutableLiveData<Bitmap> eventLogo;
37+
private Long numberOfBookmarkedSessions;
3738

3839
public AboutFragmentViewModel() {
3940
realmRepo = RealmDataRepository.getDefaultInstance();
@@ -58,10 +59,12 @@ public List<String> getDateList() {
5859
}
5960

6061
public LiveData<List<Object>> getBookmarkedSessions() {
61-
if (sessions == null) {
62+
if (sessions == null || numberOfBookmarkedSessions != realmRepo.getBookMarkedSessionsLength()) {
6263
LiveRealmData<Session> sessionLiveRealmData = RealmDataRepository.asLiveData(realmRepo.getBookMarkedSessions());
6364
sessions = Transformations.map(sessionLiveRealmData, this::getSessionsList);
65+
numberOfBookmarkedSessions = realmRepo.getBookMarkedSessionsLength();
6466
}
67+
6568
return sessions;
6669
}
6770

android/app/src/main/java/org/fossasia/openevent/data/repository/RealmDataRepository.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ public RealmResults<Session> getBookMarkedSessions() {
406406
return realm.where(Session.class).equalTo("isBookmarked", true).findAllAsync();
407407
}
408408

409+
public long getBookMarkedSessionsLength() {
410+
return realm.where(Session.class).equalTo("isBookmarked", true).count();
411+
}
412+
409413
public List<Session> getBookMarkedSessionsSync() {
410414
Realm realm = Realm.getDefaultInstance();
411415
RealmResults<Session> sessions = realm.where(Session.class).equalTo("isBookmarked", true).findAll();

0 commit comments

Comments
 (0)