|
|
|
@ -64,14 +64,20 @@ class PostService {
|
|
|
|
|
|
|
|
|
|
Future<List<QueryDocumentSnapshot<Map<String, dynamic>>>> getPostsFriends(
|
|
|
|
|
{int limit = 10, int offset = 0}) async {
|
|
|
|
|
QuerySnapshot<Map<String, dynamic>> response = await FirebaseFirestore
|
|
|
|
|
var response = await FirebaseFirestore
|
|
|
|
|
.instance
|
|
|
|
|
.collection("posts")
|
|
|
|
|
.where("user_id", whereIn: MyApp.userViewModel.userCurrent.followed)
|
|
|
|
|
.orderBy("date", descending: true)
|
|
|
|
|
.limit(limit)
|
|
|
|
|
.get();
|
|
|
|
|
|
|
|
|
|
response.docs.sort((a, b) {
|
|
|
|
|
DateTime aDate = a.data()['date'].toDate();
|
|
|
|
|
DateTime bDate = b.data()['date'].toDate();
|
|
|
|
|
|
|
|
|
|
return bDate.compareTo(aDate);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return response.docs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|