File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
android/app/src/main/java/org/fossasia/openevent Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public class AboutFragmentViewModel extends ViewModel {
34
34
private LiveData <Event > eventLiveData ;
35
35
private LiveData <List <Speaker >> featuredSpeakers ;
36
36
private MutableLiveData <Bitmap > eventLogo ;
37
+ private Long numberOfBookmarkedSessions ;
37
38
38
39
public AboutFragmentViewModel () {
39
40
realmRepo = RealmDataRepository .getDefaultInstance ();
@@ -58,10 +59,12 @@ public List<String> getDateList() {
58
59
}
59
60
60
61
public LiveData <List <Object >> getBookmarkedSessions () {
61
- if (sessions == null ) {
62
+ if (sessions == null || numberOfBookmarkedSessions != realmRepo . getBookMarkedSessionsLength () ) {
62
63
LiveRealmData <Session > sessionLiveRealmData = RealmDataRepository .asLiveData (realmRepo .getBookMarkedSessions ());
63
64
sessions = Transformations .map (sessionLiveRealmData , this ::getSessionsList );
65
+ numberOfBookmarkedSessions = realmRepo .getBookMarkedSessionsLength ();
64
66
}
67
+
65
68
return sessions ;
66
69
}
67
70
Original file line number Diff line number Diff line change @@ -406,6 +406,10 @@ public RealmResults<Session> getBookMarkedSessions() {
406
406
return realm .where (Session .class ).equalTo ("isBookmarked" , true ).findAllAsync ();
407
407
}
408
408
409
+ public long getBookMarkedSessionsLength () {
410
+ return realm .where (Session .class ).equalTo ("isBookmarked" , true ).count ();
411
+ }
412
+
409
413
public List <Session > getBookMarkedSessionsSync () {
410
414
Realm realm = Realm .getDefaultInstance ();
411
415
RealmResults <Session > sessions = realm .where (Session .class ).equalTo ("isBookmarked" , true ).findAll ();
You can’t perform that action at this time.
0 commit comments